skip to main content

TAMU Webmaster's Blog

Information and insight from the A&M Webmasters

Using GTM to block test and dev sites

August 28th, 2017 by Erick Beck

I would guess that few of us remove our Google Analytics or Tag Manager calls from our site code when it is on a test or development server.  Depending on your setup, this could mean that hits to these environments increment (and distort) the analytics for your production sites.  A simple use of a blocking exception can prevent this.

This process is even simpler than previous examples since we don’t have to use a GA variable at all. Here, we just set up a blocking trigger that fires when the page hostname contains “test” or “dev” or whatever string you use to differentiate your test environment from production.   Then add this trigger as an exception on your site’s tag and none of your test/development sites will add to your analytics count.

Monday, August 28th, 2017 Uncategorized
Share this article

No comments yet.

Leave a comment