How to use lookup tables in GTM to manage multiple environments
Why I might need to use a lookup variable in GTM
In most organisations it is common practice to utilise different environments for development, test and UAT. The environments are used to validate new code at varying stages of the web development process, including building an analytics measurement strategy.
A common issue I find in GA is one that the main or production tag is used on all domains including those used for testing. As a result traffic and conversion metrics including sales revenue can be polluted by test activity making the analytics data inaccurate.
In this post I want highlight a simple mechanism within GTM to easily manage this and avoid the issue.
- Setup a user defined variable in GTM, select ‘lookup table’ and choose hostname as the input value.
2. Add rows to the table entering the different environement domain names and the GA properties you want that data to flow into.
3. Once your lookup table is complete you will need to add it to your GA tags, this will be either direct within each tag via the ‘Tracking ID’ field or with your ‘Google Analytics settings’ variable depending on your approach.
All done! That is it, now when your dev team crawl the dev.brandx.com website placing orders and triggering goals this information will be sent to the GA property for DEV avoiding interference with your customer data.
If you have any questions or would like to talk about your own measurement strategy get in touch.