Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signup links index to data_attributes #3140

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

JamesCGDS
Copy link
Contributor

@JamesCGDS JamesCGDS commented Aug 25, 2023

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

On finder pages, signup links can appear at the top and bottom of the page and they are rendered as separate modules. For GA4 analytics purposes, however, we want to treat these separate modules as if they were in the same module and combine their index values.

For example, if there are 2 signup links at the top of the page, their current index properties are index_link: 1/2, index_total: 2. Similarly, if there are a further 2 signup links at the bottom of the page, their current index properties are also index_link: 1/2, index_total: 2. We want to combine these index properties so that they become index_link: 1/2/3/4 and index_total: 4.

This PR calculates the index values in app/presenters/signup_links_presenter.rb and adds them to the data_attributes hash, which ultimately sets the data-ga4-index attribute in the govuk_publishing_components/components/subscription_links component.

Credit for the code used in this PR belongs to @andysellick

Examples:

Why

Trello card

Visual changes

N/A

@JamesCGDS JamesCGDS added the do-not-merge Indicates that a PR should not be merged into master / release branches label Aug 25, 2023
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 August 25, 2023 15:33 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 August 25, 2023 15:34 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 August 25, 2023 15:39 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 August 25, 2023 15:54 Inactive
@andysellick andysellick changed the title [DO_NOT_MERGE] Add signup links index to data_attributes [DO NOT MERGE] Add signup links index to data_attributes Sep 11, 2023
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 September 11, 2023 10:27 Inactive
@andysellick andysellick marked this pull request as ready for review September 11, 2023 10:30
@andysellick andysellick changed the title [DO NOT MERGE] Add signup links index to data_attributes Add signup links index to data_attributes Sep 11, 2023
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3140 September 11, 2023 10:30 Inactive
@andysellick andysellick merged commit 8f49ac7 into main Sep 11, 2023
7 checks passed
@andysellick andysellick deleted the fix_subscription_links_index branch September 11, 2023 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge Indicates that a PR should not be merged into master / release branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants