Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with integrating GTM Lookup Tables for multi-environment setup

I have been working on integrating GTM and GA to my website, using Environment Variables to setup GA Property Views for different setups.

I found similar solutions in various blogs, i.e., by setting up Lookup Tables or RegEx Table, with lookups for GA-Tracking-ID.

ISSUE

Lookup Tables adds a prefix vtp_ to the keys present in default GA-settings obj, as shown below:

Default GA-Settings Object

enter image description here

Due to this, GA doesn't work. If I use the GA Settings Variable directly, Everything works fine.

This happens on current Dashboard Setups for GTM and GA.

like image 743
phoenisx Avatar asked Oct 20 '25 05:10

phoenisx


1 Answers

You cannot use a Google Analytics Settings variable as the output of a Lookup Table variable for a simple reason:

The "Google Analytics Settings" field in a tag is the only place where you can use a Google Analytics Settings variable, and it is the only type of variable you can use there.

In other words, if you create a Lookup Table variable that returns Google Analytics Settings variables, there's no place to add that variable to, since the only valid place would be the Google Analytics Settings field which, as noted above, doesn't accept Lookup Table variables.

Trying to add the Lookup Table into the "Tracking ID" field, for example, is a mistake, since the table returns a Google Analytics Settings object rather than a valid tracking ID.

like image 60
Simo Ahava Avatar answered Oct 22 '25 06:10

Simo Ahava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!