Google Analytics and Sub Domain Tracking
Google Analytics is one of the most powerful analytical tools available for your website. What's even better is it's free. Knowing what traffic on your website is and is not doing should be an essential part of your business. But there are times when the out of the box installation of Google Analytics is not enough for your website. This article will deal with setting up a complex installation of Google Analytics to track an eCommerce site that is split across multiple sub domains.
Your example setup would look similar to the following:
The following points are essential when setting Google Analytics up to track this website:
1) Set the domain name on each page of your main website and sub domain using the following Google Analytics code:
This will ensure that your sub domain sites do not appear as referral sites to your main website. For example if a user clicked from, subdomain_1.yourmainsite.com -> yourmainsite.com, the sub domain would appear as a referral site without the code above.
2) With the above code set all traffic to the main website and sub domains will be tracked correctly. But if you have identical pages sitting under both the main website and sub domains, you will not be able to tell what page received the traffic. For example if you had the following:
Google Analytics will just show traffic to / page1
To fix this you can add the following advanced Filter:
Field A -> Extract A: Hostname: (. *)
Field B -> Extract B: Request URI: (. *)
Output To -> Constructor: Request URI: / $ A1 $ B1
Field A Required – Yes
Field B Required – No
Override Output Field – Yes
Case Sensitive No
The sub domain will now appear in front of the page ie subdomain_1.yourmainsite.com/page1
3. Finally you can implement an Advanced Segment to track what landing pages on your main site and sub domains result in conversion.
– Choose to create a new Advanced Segment
– Firstly choose "Landing Page" from under Content
– Secondly choose "Affiliation" from under eCommerce
This will allow you to see all landing pages that lead to conversions.