Track Multiple Domains and Use Multiple Google Analytics Accounts

1 minute read

Tracking multiple domains on the same google Analytics is not a big deal but is a little tricky. If you haven’t checked all the boxes, you might not get it up and running. Here are the basic steps to track multiple websites.

  • Have the site up with default profile using basic GA setup.
  • Now make sure in Google Analytics property setting, you have “Multiple top-level domains of touchsy” checkbox set to ON. You can find this setting in “tracking info”
  • Now add the following code to your website:
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
  _gaq.push(['_setDomainName', document.domain]);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);
  • Create a new profile in your GA property
  • On the filters, click on “Create New Filter”->Custom Filter->Advanced
  • On FieldA->ExtractA, Select Hostname and Add a value (.*)  Remember the brackets.
  • On FieldB->ExtractB, Select Request URI and Add value (.*)  Remember the brackets.
  • On Output To->Constructor, select Request URI and put value $A1$B1
  • Field A Required -> No, Field B Required  -> No, Override Output-> yes
  • Save (refer Image)

You would now see complete URLs for the visited pages in your GA report.

 

Multiple Google Analytics Accounts on single website

Track a website on multiple google analytics accounts:

  1.  Do not include ga.js script multiple times. Include just once.

  2. Include the following code on your website

_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
  _gaq.push(['_setDomainName', document.domain]);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  // Second tracker 
  _gaq.push(['secondAcc._setAccount','UA-YYYYYYYY-Y']);
  _gaq.push(['secondAcc._setDomainName', document.domain]);
  _gaq.push(['secondAcc._setAllowLinker', true]);
  _gaq.push(['secondAcc._trackPageview']);

Leave a Comment