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

[DO NOT MERGE] Pass attachment name to GA4 details component tracking #4601

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AshGDS
Copy link
Contributor

@AshGDS AshGDS commented Jan 31, 2025

What/Why

  • On pages with attachments, all of the Request an accessible format details elements have the same GA4 title/section - they all pass Request an accessible format as their title/section when clicked.
  • This means PAs can't tell which details component have been clicked, as they're all passing the same data.
  • For example, see the attachments on https://www.gov.uk/guidance/prove-your-english-language-abilities-with-a-secure-english-language-test-selt
  • Therefore this PR makes the section values the name of the attachment they are sitting under.
image

Visual Changes

None.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4601 January 31, 2025 15:40 Inactive
@AshGDS AshGDS force-pushed the ga4-details-attachment-section branch from a6e1d6c to b60f417 Compare January 31, 2025 16:01
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4601 January 31, 2025 16:01 Inactive
@AshGDS AshGDS force-pushed the ga4-details-attachment-section branch from b60f417 to 9cfa2b2 Compare January 31, 2025 16:02
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4601 January 31, 2025 16:02 Inactive
@andysellick
Copy link
Contributor

@AshGDS can I check is this solution going to work on the page you linked to, as the attachment itself appears to be buried in govspeak and not something we can pass options to?

@AshGDS
Copy link
Contributor Author

AshGDS commented Feb 3, 2025

@andysellick Yeah, govspeak renders the attachment component, though the attachment component is what will be passing the title to the details component. The details component is rendered inside of the attachment component, so I think this should be OK as we don't need to pass anything ourselves, the attachment component does it for us.

It's difficult to test locally because in order to update the HTML on all these pages, we have to republish all our documents with attachments, so that govspeak regenerates the attachment component HTML.

See https://github.com/alphagov/govspeak/blob/df4d00a7e8d073a31677acf4e88093e157819b4d/lib/govspeak/post_processor.rb#L69

However, I've been asked to hold off on this change for now, so there's less need to review this.

@AshGDS AshGDS changed the title Pass attachment name to GA4 details component tracking [DO NOT MERGE] Pass attachment name to GA4 details component tracking Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants