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 tracking to the travel advice pages #2215

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

andysellick
Copy link
Contributor

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

  • uses the new feature of the track click script to track link clicks only inside the grey callout box (the second callout box on the page)
  • this is inside govspeak content so we can't directly apply tracking to it, hence the new feature of the track click script to limit tracking to a specific element

Trello card: https://trello.com/c/JREgQ2iv/579-spike-into-tracking-enhancements

- uses the new feature of the track click script to track link clicks only inside the grey callout box (the second callout box on the page)
- this is inside govspeak content so we can't directly apply tracking to it, hence the new feature of the track click script to limit tracking to a specific element
@bevanloon bevanloon temporarily deployed to government-f-add-tracki-qvgj5m September 2, 2021 08:36 Inactive
@andysellick
Copy link
Contributor Author

@leenagupte you're right, this tracking wraps the majority of the page content and not only the grey box (the thing we want to track).

This is why I've added a feature to the track clicking script data-limit-to-element-class, which enables the tracking to be targeted to (links in) a specific element only. This PR will fire tracking events only when links in the .call-to-action box are clicked.

@leenagupte
Copy link
Contributor

leenagupte commented Sep 9, 2021

@leenagupte you're right, this tracking wraps the majority of the page content and not only the grey box (the thing we want to track).

This is why I've added a feature to the track clicking script data-limit-to-element-class, which enables the tracking to be targeted to (links in) a specific element only. This PR will fire tracking events only when links in the .call-to-action box are clicked.

Ah, OK, so it's looking for <div class="call-to-action"> within current_part_body and just adds the tracking to that bit?
On the off-chance that the name of the div changes, I think this tracking will stop working unexpectedly. Is there anyway to mitigate that?

@andysellick
Copy link
Contributor Author

Ah, OK, so it's looking for <div class="call-to-action"> within current_part_body and just adds the tracking to that bit?
On the off-chance that the name of the div changes, I think this tracking will stop working unexpectedly. Is there anyway to mitigate that?

Correct. And yes, if the class name of the box changes then the tracking will stop working, so it's not ideal, but it's the only way to put tracking into this area. However, the class name is a govspeak class, which is very unlikely to change - we don't often make changes to govspeak like that. And if the tracking does stop working and it's still required, I'm sure the PA community will notice.

Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

Thanks for the explanations 💯
I've tested this locally, and it LGTM 👍

@andysellick andysellick merged commit 05e81a5 into main Sep 10, 2021
@andysellick andysellick deleted the add-tracking-to-callout-box branch September 10, 2021 10:08
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