Search code examples
google-tag-managertrackingevent-trackinghotjar

Is it possible to have different tags included in different environments in GTM?


I have two different environments for my account in Google Tag Maneger: Staging & Live. I want to have some tags for only staging environment but when I publish the changes to live environment, everything goes live. Is there a way to divide the tags as some of them is for staging and some for live? Thanks!


Solution

  • Technically yes, you can publish a version to the Staging Enviroment, then remove your changes and publish to the live environment. Does not really make sense, though.

    To comply with the spirit of your question rather than the words, you can create a trigger based on the built-in "environment name" variable that either fires tags only when you are on staging, or works as an exception trigger and blocks certain tags when you are not in the staging environment. So all tags will be "live", but some will never be fired unless you're on the staging environment.