Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamically set Google Tracking ID

andrew_r-GrfLbX
Level 7
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
andrew_r-GrfLbX
Correct answer by
Level 7
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]);

View solution in original post

1 Reply
andrew_r-GrfLbX
Correct answer by
Level 7
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]);

View solution in original post