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

Replace GTM variable {{CJS - data-cta-type (filtered for GA4)}} with non-JS version #13951

Closed
2 tasks done
Tracked by #14749
stephaniehobson opened this issue Nov 30, 2023 · 0 comments
Closed
2 tasks done
Tracked by #14749
Assignees

Comments

@stephaniehobson
Copy link
Contributor

stephaniehobson commented Nov 30, 2023

In UA when we tracked the cta_click event we used the data-cta-type value differently than we are planning on using it in GA4. At the moment there is some custom JS in GTM to transform the value of the data-attribute into a more appropriate value for the GA4 cta_click event.

When we remove the UA code we can edit the values of data-cta-type in bedrock and do away with the custom JS variable in GTM.

if(element.tagName.toLowerCase() == 'a' && type == '') {
      if(element.href.indexOf('https://relay.firefox.com') == 0 ) { type = 'relay'; }
      if(element.href.indexOf('https://monitor.firefox.com') == 0 ) { type = 'monitor'; }
      if(element.href.indexOf('https://getpocket.com') == 0 ) { type = 'pocket'; }
      if(element.href.indexOf('https://accounts.firefox.com') == 0 ) { type = 'account'; }
      if(element.href.indexOf('https://accounts.mozilla.org') == 0 ) { type = 'account'; }
}
  • Edit or remove data-cta-type values in bedrock to match output of CJS
  • Remove the custom JS from GTM in favour of an un-altered value for data-cta-type
@stephaniehobson stephaniehobson changed the title [GTM] Replace variable {{CJS - data-cta-type (filtered for GA4)}} with non-JS version Replace GTM variable {{CJS - data-cta-type (filtered for GA4)}} with non-JS version Nov 30, 2023
@stephaniehobson stephaniehobson self-assigned this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant