Track SubDomains Part 2 :: Google Analytics :: link(), linkByPost()

by on April 2, 2009

In my last post strategically called sub domain tracking part 1, I went through some pointers to go through when setting up Google Analytics across sub domains. This is really just a follow up post to mention the remaining aspects around sub domain tracking and tracking between domains. Analytics is key if you are to implement a solid SEO strategy.

Often you will need to track between multiple domains to capture all required information around your website. This is usually when you direct users to a 3rd party shopping cart that sits on a different domain. As Google sets first party cookies the users session will be lost between domains and what you will probably end up with is self referring stats i.e. you will see one domain appearing as a referral to the other.

To resolve this issue you need to do the following:

Within your standard Google Analytics tracking code you need the following two lines:

pageTracker._setDomainName(“none”);
pageTracker._setAllowLinker(true);

After this you can use the link() method to tag all links between domains. This method will send the Google Analytics cookies between the domains via the URL. For example:

Go to our site Domain 1

You need to tag all links between the sites in both directions.

For those cases where you are link between domains via forms you can use linkByPost(). This updates the forms action parameter to ensure the cookies are passed between domains.

….

This process is not always straight forward and doesn’t work every time you implement it. For most problems taking a capture of the Live HTTP headers and looking through for the Google Analytics cookies is best. Also with the link() function you should be able to see the Google Analytics paramaters attached to the URLs.

Share

Previous post:

Next post: