Importance of Cross Domain Tracking in Google Analytics


If you are managing ads for websites where the visitor comes to the site from one source and then moves to a different domain for purchase or checkout?

You want to track multiple domains in the same analytics property, how?

You want to track the users journey that involves multiple domains in the same GA property?

Answer: Implement Cross Domain Tracking for both the websites.

Remember, Google Analytics by default does not track two different domains in the same property, if you want to get this done you have to make changes to the regular Google Analytics Tracking Code.

Earlier, making changes to this GATC is an hard one, you had to go through Google Analytics Developers Environment to get this job done.

The steps that involved was to add few extra lines of code to the existing tracking code so the users information is passed from one domain to other domain using the client ID.

The user information is stored in Google Analytics Cookie i.e. _ga cookie, and the cookie is always stored on per domain basis, which means when a cookie is issued by domainA, then the website that issues the cookie will only be able to read the cookie and user information in the cookie. This is because of the browsers same origin policy.

So now when the user moves from one domainA to domainB, the cookie information is not passed to domainB, and the domainB treats it as a new users and attributes all of the hits to a new session.

So we have to find a way to transfer this user information in the cookie to the target domain. To do this we have to implement cross domain tracking for both websites.

The Objective of the Cross-Domain Tracking is

  1. to attribute all the hits on different domains to the same session
  2. link all the sessions to the same user.

When you implement cross domain tracking, the user information is passed with Client ID to the second domain, so the second domain may treat the user as a same user rather than calling it as a new user.

If you want to hard code the GATC, then here is what you need to add to the code so you can implement cross domain tracking.

Set the cookie domain to auto i.e. adding cookie domain to auto.

ga(‘create’, ‘UA-7865678-67’, ‘auto’)

Now you need to add a linker parameter and set it to true to tell GA about both the domains. You do this by adding this code to GATC i.e.

{‘allowlinker’: true}

So the new code will look like

ga(‘create’, ‘UA-7865678-67’, ‘auto’,{‘allowlinker’: true});

Once you are done with this, you need to setup the auto link Plugin, to do this

Ga(‘require’, ’linker’);

Then you need to invoke the autolink plugin, to do this

Ga(‘linker:autoLink’, [‘domainB.com’])

So now the whole code, will look like this:

ga(‘create’, ‘UA-7865678-67’, ‘auto’,{‘allowlinker’: true});

ga(‘require’, ’linker’);

ga(‘linker:autoLink’, [‘domainB.com’]);

Once you hard code these changes to the GATC, the GA will track the users moving across domainA and domainB as a single users and tie all the hits to the same session.

Note: The cross domain tracking is simple and can be done in 3 easy steps with Google Tag Manager. They follow the same method and all of them are defined and there is no need to hard code the GATC.

Interested in Learning such advanced topics of digital marketing then consider checking our digital marketing training bootcamp in hyderabad.

No Comments
prev next
Leave a comment
make Marketer-logo-black
CORPORATE ADDRESS
+91 99486 34516
#301, 3rd Floor, Elite Plaza, Above Musaddilal Jewellers, Punjagutta, Hyderabad 500082,
India
admission@makemarketer.com
opening hours
Monday - Friday
9:00 AM to 8:00 PM
Saturday
9:00 AM TO 6:00 PM
Sunday
Closed
Please check that this widget Google Reviews has a Google Place ID set.