Google Analytics Experts

From EpikOne

My site uses a third party shopping cart and sub-domains. How do I set it up?

Rating: +0

Positive Negative

Your settings depend on how you plan to track your traffic. If you want to track all of the traffic in one profile then you need to change the JavaScript that you reference on your sub-domain pages. You will need two different sets of JavaScript.

Here's an example:

Customer Process:
1. webiste.com
2. store.website.com
3. purchase at monstercommerce.com

Here are the two sets of JavaScript you will need:
For pages on website.com and monstercommerce.com:

>script src="http://www.google-analytics.com/urchin.js"
type="text/JavaScript"<
>/script<
>script type="text/JavaScript"<
_uacct = "UA-xxxxxx-xx";
_udn="none";
_ulink=1;
urchinTracker();
>/script<

For pages on store.website.com:

>script src="http://www.google-analytics.com/urchin.js"
type="text/JavaScript"<
>/script<
>script type="text/JavaScript"<
_uacct = "UA-xxxxxx-xx";
_udn="website.com";
_ulink=1;
urchinTracker();
>/script<

Here's the important thing to understand. The urchin.js can only detect cookies that have the same domain as the domain that the user is currently on. This means that if you set a cookie with a domain of store.website.com, then the urchin.js on website.com will not be able to 'see' those cookies! GA will set another set of cookies which will distort your traffic. This is really important to understand.

The key is to configure GA so that the domains of all the cookies, except for the cookies on the third party domain (monster commerce), are the same.

When you set _udn="none" the urchin.js will use the sub-domain and primary domain in the location bar as the domain for the cookie. That's why you want to include _udn="website.com" for all the pages on the store.website.com domain. This will force the domain of the cookies to website.com, which matches the cookie domain set by the code on mysite.com.

This configuration will make the cookies readable by the urchin.js on store.website.com and website.com. Therefore GA will be able to track the visitor as a single visitor.

Don't worry about the cookies on monstercommerce.com. That will work fine and I don't think I have any more typing in me :)

Go Back