This is a 3 part series on cross-domain tracking with Google Analytics in non-standard situations:

  1. Part 1
  2. Part 2
  3. Part 3

In figuring out how to use Google Analytics on a site that spans multiple top level domains, (i.e. transfer cookies across multiple domains) there are many good resources out there (books, blogs, helpfiles and more). Given the amount of work done on this topic and the frequency with which it occurs on websites, you might not think this would be a difficult problem, and in most common cases, it isn’t.

But while there are well documented and standard methods that specifically deal with hyperlinks and HTML forms, you may find yourself in some unfamiliar territory if your site uses other types of navigation methods (scripted redirects, server-side, etc…).

Take, for example, the simple snippet below:

Link across top level domains
function redirectFunction()
{
window.location.replace('http://www.xxx.yyy/RedirectTarget.html');
}
 

To address this one, you might write a wrapper function that encapsulates the redirect and inserts a call to the pageTracker._link() function, so we’d do something like the following:

function redirectFunction()
{
window.location.replace(GoogleAnalyticsCookieAppend('http://www.xxx.yyy/
RedirectTarget.html'));
}
function GoogleAnalyticsCookieAppend(uri)
{
pageTracker._link(uri);
return uri;
}
 

Note: You’ll want to make sure to include the “return false” at the end of your call here.

This will work for cases where we have a hyperlink (anchor tag) doing this direct javascript call, as follows:

 This one tries indirectly  
 

But what about something that’s not a hyperlink, like a div container?

 
Content for this container
 
 

This is neither a hyperlink nor a form, and our attempts at solving this problem with pageTracker._link() and pageTracker._linkByPost() just don’t seem to work…

Continue to Part 2

Message Sent

Thank you for registering.

Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Thank you for submitting the form.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.

Message Sent

Thank you for registering.

Thank you for your submission.

Your request has been submitted and a rep will reach out to you shortly.

Message Sent

Thank you for your interest.

Thank you for registering.

You should receive a confirmation email from GoToWebinar with your unique webinar login information. If you do not receive this email or have trouble logging in to the event, please email asmaa.mourad@cardinalpath.com.

Thank you for subscribing!

You're now looped into the world's largest GMP resource hub!

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Success! Thank you
for reaching out.