Expand my Community achievements bar.

Check out the 3rd Edition of the AEP Community Lens for all the latest releases, resources, and Community updates
SOLVED

Dynamically set Google Tracking ID

Avatar

Level 7

Hi all,

I need to implement Google Analytics in DTM but dynamically change the tracking ID based on the domain name, we currently override the Adobe report suite on Adobe Analytics tool using an IF statement but not sure how to do the same thing on GA tool?

Any help will be great

Cheers

1 Accepted Solution

Avatar

Correct answer by
Level 7

Answered my own question...

Example below added to customise page code in the GA tool:

var gaProperty //store the property if(location.host == ("xxx"))  { gaProperty = 'UA-1234567-1'; } else if (location.host == ("xxx")){ gaProperty= 'UA-1234567-1'; } else { gaProperty= 'UA-1234567-1'; } _gaq.push(['_setAccount', gaProperty]);
1 Reply

Avatar

Correct answer by
Level 7

Answered my own question...

Example below added to customise page code in the GA tool:

var gaProperty //store the property if(location.host == ("xxx"))  { gaProperty = 'UA-1234567-1'; } else if (location.host == ("xxx")){ gaProperty= 'UA-1234567-1'; } else { gaProperty= 'UA-1234567-1'; } _gaq.push(['_setAccount', gaProperty]);
page footer