Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Google Analytics Cross Domain

Use GA code across multiple domains including a checkout



7:43 pm on Jun 8, 2011 (gmt 0)

5+ Year Member

I want to use GA across several domains including a yahoo merchant checkout. I have a "corporate" site, a "store" site and a secure checkout domain that currently have separate GA profiles.

I think in order to have cross-domain analytics you need a different tracking code. Has anyone done this or similar? What happens to my existing profiles? is there a way to make one of these existing accounts the new "main" account?

Any help would be appreciated!


11:17 pm on Jun 27, 2011 (gmt 0)

Way I set it up in the past is to have a separate profile for rollup reporting to track round trips, as well as domain specific one.

For example:
<script type="text/javascript"> 

var _gaq = _gaq || [];
['main._setAccount', 'UA-30264xx-1'],
['main._setDomainName', 'none'],
['rollup._setAccount', 'UA-30264xx-2'],
['rollup._setDomainName', 'none'],
['rollup._setAllowLinker', true],

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


Then depending on how many outbound links you have to your other domains you either tag each manually or put together a script to automate it for you.

Onclick for outbound link (I also include an event to see outbound links in main profile) :
_gaq.push(['main._trackEvent', 'External Link', 'Asset' , 'http://otherdomain.com']);_gaq.push(['rollup._link', 'http://otherdomain.com']); return false;

Lastly, in your rollup profile, create a filter to append the hostname to your URI so you can tell them apart.

Hope that helps.

Featured Threads

Hot Threads This Week

Hot Threads This Month