gatsby-plugin-google-tagmanager/gtag: Support including gtm.js and gtag.js from a custom url #32331
Unanswered
guysherman
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
A while back google introduced "Server-Side Tagging" to GTM. This has a couple of main benefits: you can use GA4 events on the client side to trigger all the rest of your tags from the server, so you don't need to bog your page down with all those chunky scripts.
Also, and perhaps more importantly, it lets you serve gtm.js, gtag.js and analytics.js from your own domain, rather than google's domains, which makes them appear a little less third-party to ad-blockers etc.
I would like to update the following plugins to support this:
My proposal is to add an optional parameter to each of these packages, allowing the user to supply the url of their gtm SST server to the plugin, and then substitute this into the snippet that is rendered out by the plugins. I'll set the default value for these parameters such that the generated snippet includes the standard url.
I'm using a custom package on my site for now, but would prefer to commit this change back to the repository and stick with the standard packages, and hopefully this helps others as well.
I'm working on the PR at the moment, but figured raising it here was the right first step.
Thanks,
Guy.
Beta Was this translation helpful? Give feedback.
All reactions