Dynamically set Google Tracking ID | Community
Skip to main content
andrew_r-GrfLbX
Level 5
October 16, 2015
Solved

Dynamically set Google Tracking ID

  • October 16, 2015
  • 1 reply
  • 1053 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by andrew_r-GrfLbX

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

andrew_r-GrfLbX
andrew_r-GrfLbXAuthorAccepted solution
Level 5
October 20, 2015

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]);