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

Extend track click script #2263

Merged
merged 3 commits into from
Aug 12, 2021
Merged

Extend track click script #2263

merged 3 commits into from
Aug 12, 2021

Conversation

andysellick
Copy link
Contributor

What

Modify GemTrackClick so that if no data-track-label attribute is provided, the text of the link clicked will be used.

  • this will allow tracking to be added to a wrapping element containing links managed outside of an editable template

Why

We want to add tracking to links within an element where the content is managed outside of the template (e.g. a YML file) and the content is subject to change, without having to keep ensuring the links have the right data attributes. This allows us to add the module, action and event attributes to the parent, and the script will automatically use the text of the clicked link as the label.

Visual Changes

None.

Trello card: https://trello.com/c/Q6kr2nFK/551-add-ga-tracking-codes-to-fcdo-call-out-box-of-covid-info

@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 11, 2021 14:13 Inactive
@andysellick andysellick requested review from alex-ju, danacotoran and injms and removed request for alex-ju August 11, 2021 14:14
@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 11, 2021 14:14 Inactive
injms
injms previously approved these changes Aug 11, 2021
Copy link
Contributor

@injms injms left a comment

Choose a reason for hiding this comment

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

Neat - looks good to me 👍

@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 12, 2021 07:20 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 12, 2021 07:48 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 12, 2021 07:49 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 12, 2021 07:49 Inactive
- modified so that if no label is provided, the text of the clicked link is included as the label
- this will allow tracking to be added to a wrapping element containing links managed outside of an editable template
- allows the tracking to be added to an element so that any links (and only links) within it will be tracked
- this prevents other clicks within the same element from being tracked unnecessarily
@andysellick andysellick requested a review from injms August 12, 2021 07:54
@bevanloon bevanloon temporarily deployed to govuk-publis-extend-tra-r1ctg1 August 12, 2021 07:54 Inactive
@andysellick andysellick dismissed injms’s stale review August 12, 2021 07:54

I've added another commit and it needs reviewing again.

@andysellick andysellick merged commit 9295678 into master Aug 12, 2021
@andysellick andysellick deleted the extend-track-click branch August 12, 2021 08:59
injms added a commit that referenced this pull request Aug 12, 2021
Includes:

* Extend track click script (#2263)
* Fix cookie banner issue (IE10) (#2231)
* Extend layout for public with account components (#2255)
* Update search toggle tracking (#2262)
@injms injms mentioned this pull request Aug 12, 2021
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.

4 participants