Automatic Cross Domain Tracking
(Update: We have an automatic cross domain tracking script for the asynchronous version of Google Analytics. Check it out!)
Whenever a visitor crosses from one domain to another, the information contained in the cookies must be passed in the query string to the second domain. Google Analytics documentation recommends using the provided method of _link(). This looks like:
<a href=”http://www.newsite.com” onclick=”pageTracker._link(‘http://www.newsite.com’);return false;”>Go to our sister site</a>
Following this link will cause the visitor to arrive on the page http://www.newsite.com/?__utmb=. . . .&__utmv=. . . .&_utmk=123456789&__utma=1.1234567.1234567. . .&utmz=. . .
With the values of those query parameters used by the GA code on the new site to create the necessary tracking cookies.
But when you have a very large number of links that cross from one domain to the other, it is difficult to find and modify every one, and to continue to maintain and update new links as they are created in the site.
There are several examples of scripts like this, and sometimes the script will need to be modified slightly to suit a particular web site or particular needs.
iQ Content published an autotracking script in this blog post:
An example of a script that I used for a particular client:
You can also find script examples in the books:
* Advanced Web Metrics by Brian Clifton (http://www.advanced-web-metrics.com/blog/about-the-book/)
* GA Short Cuts by Justin Cutroni (http://gashortcut.com/)
If you have an example of an automatic tracking script for GA you’d like to share, link to it in the comments below.