DEV Community


make your dev mgr AND your mktg mgr happy by migrating to google tag manager based analytics today

osde8info profile image Clive Da ・1 min read

google are moving users away from the old google analytics javascript and analytics ids to new google tag manager javascript and google tag manager ids

NOTE when choosing to use a single container across multiple domains, it's important to carefully configure your tags and triggers within Google Tag Manager. Using the default “All Pages” trigger in Google Tag Manager (i.e. $url matches RegEx) will fire tags on all pages of all domains on which your container snippet is deployed.

here is an example of how to use node, node-fs, express and pug to dynamically generate HTML and JS that includes your NEW google tag manager id from your ENV so that if someone clones your @glitch or @zeit node project they DONT get a copy of your GTM ID :)

the top of your rendered html should end up like this note the code between the "Google Tag Manager" comments




the entire project on glitch

the entire project on github

GitHub logo osde8info / glitch-mapsaw

glitch mapsaw node express pug

see also

Discussion (0)

Editor guide