Skip to content

how to integrate Tag Manager #216

Answered by thomHayner
mikkivirus-dev asked this question in Q&A
Discussion options

You must be logged in to vote

@prototypa I also wanted to add Google Tag Manager to my project, I followed the same pattern as your @astrolib/analytics package for Google Analytics. It's just one extra/alternate script (Google will disable your site's GA4 tags and force you to go through GTM if you create a GTM property for your website).

You are welcome to it, anyone else may use it as well.

Tested and working on localhost in Google Tags Debug Mode and on my website deployed to production.

Semi-packaged code is here.
Other necessary updates to configBuilder.ts and config-schema.json are here.
As well as config.yaml updates here.
Then add two new components to src/components/common, BodyTag here, HeadTag here.
Then in…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mikkivirus-dev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by prototypa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants