Separate Your Debug Traffic with A Lookup Table

When you start using GTM for the first time you may not need this, but with time you’ll start implementing more and more events, do more testing and debugging, and this will seriously disrupt your data. While this is easily fixed if you just filter your traffic in GA – it’s always better to have a backup plan. Another reason to use a separate property for your testing is to easily check your events, and not the events generated by your current visitors (this is especially valid in the Real Time report, where limited events are shown -20 rows, and if your site has huge traffic – you won’t be able to see your test events).

Good news everyone – all it takes to fix this is enabling one built in variable and create one simple Lookup Table Variable. Your debug traffic will be separated in no time!

Step One – Create a new property in Google Analytics

Create a new property in GA, which will be used to collect all the debugging data. You can name it as you wish (for example –  ‘Debug –’). Don’t place any filters on it, it’s your personal debug property and you’ll want to see everything that goes on.

Step Two – Enable the Debug Mode

There is a built-in variable in Google Tag Manager called Debug. You just need to enable it, as it’s disabled by default:

Enabling Debug Mode in GTM

What this variable does is returning true if you browse your website with Preview mode and false otherwise.

Step Three – Create the Lookup Table Variable

Go to Variables and create New Lookup Table Variable. Name it as you wish (I always name my Lookup Tables ‘LT – Some Name’). Choose {{Debug Mode}} as input and add two rows.
In the first row add as input true. As output type the UA code of the newly created debug property.
In the second row add as input false and your original UA code as output (the one of your main Google Analytics property).
Setting up the Debug Lookup Table

Step Four – Deploy the Lookup Table in your events

This step could be cumbersome or easy, depending on your current GTM setup. If you followed my advice in The little hero of GTM – The Constant Variable – just edit your Constant Variable so it takes the new Lookup Table as value, instead of hard coding the UA code. It will automatically deploy itself in all of your Analytics tags:
Adjust your GA UA constant variable If not – You’ll need to change the UA codes in all of your tags with the variable.

You just need to publish your container now and voila – you have your separate debugging property ready!

Check these related articles:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.