Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a main site that Google analytics is currently running fine on (www.ourcompany.com). We have a page that is technically part of the site (same design, etc.) but is hosted on another server/domain for various business reasons (www.ourparentcompany.com/ourcompanyapp/).

Do we just add the normal google analytics code to the bottom of that page? Or is there something more we have to do?

If there isn't anything more then couldn't anyone just take your GA code and start reporting analytics to your profile from their site?

share|improve this question
add comment

1 Answer

You need to either set the domain name to 'none' OR remove the domain hash otherwise visits from one of the sites won't get tracked:

Either:

_gaq.push(['_setDomainName', 'none']);

Or:

_gaq.push(['_setAllowHash', false]);

You should use the first operation when you are tracking across domains but not across sub-domains. If you need to track across sub-domains as well then you should use the second approach.

You also might want to use the linker so that the GA cookies are transferred across to the other domain when a user moves onto it from a link in the other site:

  _gaq.push(['__setAllowLinker', true]);

However, the cookies won't be available from one domain on the other if the user enters from a source other than one of your sites. This is because GA uses first party cookies.

share|improve this answer
    
Does it need to be 'none' on both sites or just the "third party" one? –  Ben Mar 2 '11 at 19:22
    
I don't think you're right about the _setDomainName needing to be set to none. Can you provide documentation? –  Yahel Mar 2 '11 at 19:34
    
You need to set 'none' on both sites. –  Ewan Heming Mar 2 '11 at 19:54
    
code.google.com/apis/analytics/docs/tracking/… Makes it seem like that's not the case. I've successfully implemented tracking using the linker, and never have had the need to setDomainName to none to get it to work properly. In this example, you can just set the pertinent domain, and then use the linker to link the cookies. –  Yahel Mar 2 '11 at 20:00
    
Here's the documentation I was reading: code.google.com/intl/en/apis/analytics/docs/gaJS/… - It says you should set the domain name to none when "You want to set up tracking across two separate domain names" –  Ewan Heming Mar 2 '11 at 20:25
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.