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 GA4 to nested contents item links #3638

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

andysellick
Copy link
Contributor

@andysellick andysellick commented Sep 25, 2023

What

  • include GA4 attributes for tracking on nested contents item links
  • includes new code to calculate the index_total (total number of links) and the index_link value for each link
  • note that where a contents list item is 'active' (i.e. not a link) this should not alter the overall index_total or index_link values, it is assumed that this non-link item is included in those counts

Index values should be as follows:

Parent link // index_link 1
- nested link // index_link 2
- nested link // index_link 3
Parent link // index_link 4
- nested link // index_link 5
- active (not a link)
- nested link // index_link 7

index_total = 7

Why

We weren't tracking clicks on nested contents items links, only on top level items.

Visual Changes

One tiny change to the doc page for this component, under GA4 tracking include an active item to help with testing.

Trello card: https://trello.com/c/ZD50PFtM/693-add-tracking-to-dashed-child-content-items

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3638 September 25, 2023 15:32 Inactive
@andysellick andysellick requested a review from AshGDS September 25, 2023 15:37
Copy link
Contributor

@AshGDS AshGDS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just needs a CHANGELOG update 👍

- include GA4 attributes for tracking on nested contents item links
- includes new code to calculate the index_total (total number of links) and the index_link value for each link
- note that where a contents list item is 'active' (i.e. not a link) this should not alter the overall index_total or index_link values, it is assumed that this non-link item is included in those counts
@andysellick andysellick force-pushed the ga4-contents-list-nested branch from 56fcc41 to 8f3fc15 Compare September 26, 2023 10:18
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3638 September 26, 2023 10:18 Inactive
@andysellick andysellick merged commit b7466d1 into main Sep 26, 2023
@andysellick andysellick deleted the ga4-contents-list-nested branch September 26, 2023 10:23
@andysellick andysellick mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants