Google Product Forums

Re: Cross domain tracking in multiple accounts/profiles


AnalyticsNinja Aug 17, 2010 8:54 AM
Posted in group: Google Analytics

Categories: The Google Analytics Coffee Shop :

To do the Rollup tracking you're in need of, there are still some things needed that aren't addressed by eBrandz

I will put comments into the code below to demonstrate.



Cross domain linking (the quotes are from the Google Analytics code base)

You must use either the _link or _linkbyPost methods on any links or actions that take a user from your store domain to your shopping cart domain.

For links:
"The _link() method passes the cookies from this site to another via URL parameters (HTTP GET). It also changes the document.location and redirects the user to the new URL. "
<a href="http://example.com/test.html"
onclick
="_gaq.push(['_link', 'http://example.com/test.html']); return false;">click mea>
For Posts:
"The _linkByPost() method passes the cookies from the referring form to another site in a string appended to the action value of the form (HTTP POST). This method is typically used when tracking user behavior from one site to a 3rd-party shopping cart site, but can also be used to send cookie data to other domains in pop-ups or in iFrames. "
<form name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);">


Contrary to the Google Analytics Code site, setDomainName does NOT need to be set to None (or called at all) for cross domain tracking.
setDomainName is necessary if you are tracking across sub-domains.

You will need to
have your GATC object declared BEFORE making calls to _link or _linkbyPost. As such, put your GA tracking code in the section of your site so that it is above any cross domain links.


Since you want to track ecommerce, you need to make sure that you call all GA ecommerce functions for both trackers. Again, quoting from the Google Tracking API