-
Notifications
You must be signed in to change notification settings - Fork 17
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 GTM script tag #399
add GTM script tag #399
Conversation
- add function to sanitize page pathnames in dataLayer payload events
- add function to sanitize page pathnames in dataLayer payload events
@@ -59,3 +59,25 @@ | |||
} | |||
</script> | |||
{{/ga4TagId}} | |||
|
|||
{{#gtmTagId}} | |||
<!-- Data Layer --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by Data layer? was this comment from you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's from the snippet code sent from the business. I think it's just a comment to explain what the code is for.
}); | ||
return str; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like github actions is complaining about some linting and styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaah thanks ...god I hate linting 😂
@@ -39,22 +49,28 @@ const setupPageMap = routes => { | |||
return pageMap; | |||
}; | |||
|
|||
module.exports = (app, config) => { | |||
module.exports = (app, config) => { | |||
const gaTagId = config.gaTagId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots of linting issues
lib/ga-tag.js
Outdated
res.locals.gaAllowDebug = config.env === 'development'; | ||
res.locals.gaTagId = gaTagId; | ||
res.locals.ga4TagId = ga4TagId; | ||
res.locals.gtmTagId = gtmTagId | ||
res.locals.appName = appName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need the appName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using it before, but no longer need it. Good spot
There was a problem hiding this 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 some minor changes
- add environmentType template variable for pageLoad event
- add validation that cookies are accepted before running GTM snippets
- move gtm snippet from body to head in gov-uk html template - validate cookies accepted before running gtm
…nd not other forms
What?
pageLoad
events to track page visitsWhy?
How?
Testing?
Screenshots (optional)
Anything Else?