Tracking multiple domains with Google Analytics can be challenging, you have to know that what you’re reporting, trending and analyzing is based on accurate data. Otherwise, you will lack proper source that attributes towards your sales and goal conversions. Unless you have a master rollup account to report all of the data from the various sites, it’s very difficult to get accurate data.
In this post, I’m going to focus on explaining how to track multiple domains and help you make sure that you’re reporting accurate source attribution. Whenever you have multiple domains, it’s easy for the data to get lost and you end up with a lot of referring traffic back to one of your websites and this doesn’t help if you’re a marketer.
Let’s pretend Storefront-A.com (Account A) sells children clothing and Storefront-B.com (Account B) sells adult clothing, in this case I made the illustration show 2 pages per site. What you would want to do is setup 3rd Google Analytics accounts tracking full eCommerce transactions under one master profile. Let’s call the 3rd account (Account C), Clothing Holdings, which would collect all the data. Make sure the master profile (Account C) has no filters, this will help you have a baseline to refer to if you make any mistakes.
Next, you have to make your sure all your Google Analytics and Adwords accounts are linked up, you’ve opted into data sharing in your Analytics account and you’ve enabled auto-tagging in your Adwords account.
This is what you should be left with based on the illustration and scenario:
- 2 websites – Storefront-A.com(UA-XXXXXXXXX-A), Storefront-B.com(UA-XXXXXXXXX-B)
- Reports (Master Profile) – Landing pages or websites report to this account (UA-XXXXXXXXX-C)
I’m going to break it down further, a vistor finds you through the children’s clothing site, Storefront-A.com, and then clicks on a link within your web site to the adult clothing store, Storefront-B.com. If you use Google Analytics on each web site independently, you won’t be able to know which landing page contributed to a sale or goal completion on the other site. You won’t be able to know the duration of the visit starting from the other website leading up to sale, whether it was an organic or paid search term and even the keyword. The only information that would show up in Google Analytics would be that the visitor was a referrer from your other web site and the referrer would be the page on your other site that had the link.
Let’s deconstruct it, starting with ‘_setAccount’ and by now I am hoping you know what that means. The ‘_setDomainName’ is set to none because it turns off a unique hash feature which only allows it to be stored with that domain which by default is otherwise set to ‘document.domain’ – you do not need to use this attribute if you are linking between subdomains, for example, Storefront-A.clothingholdings.com and Storefront-B.clothingholdings.com. If you are using 2 domains as in the scenario, use it on the respective domain and not the Master Account. The ‘_setAllowHash’ is deprecated and no longer needed to cross domains, that’s why you might see it in other older examples similar to this post.
To ensure that user information gets carried from www.Storefront-A.com.com/company/stores.php to www.Storefront-B.com we would need to pass ‘_link’ (for links):
<a onclick="_gaq.push(['_link', 'http://www.Storefront-B.com']); return false;" href="http://www.Storefront-B.com">Adult Clothing</a>
If we were passing a form from Storefront-A.com to Storefront-B.com, the tag would need to have the code example below. A common scenario for this would be an online store where the first domain would hold the actual store and another domain would hold the check out page which leads to a sale, similar to Paypal or Google Checkout. When the customer goes from web site to checkout you would use the POST method to push the visitor’s info to the next domain. The example below references this scenario:
</pre> <form method="post">
When the visitor finally makes it to the confirmation page, the only main difference would be that you would add the ‘_SetDomainName’ and ‘_setAllowLinker’ for each respective account, Account C in this case being the constant.
There is one final step. You have to create a custom filter or the referral data that carries over will not show the actual domain, so under your Admin settings, you can add a filter to show the domain in the page reports as follows:
- In the Profile Settings page, click the Add Filter link.
- Choose Add New Filter and provide the filter a name.
- Choose Custom Filter and select Advanced on the Filter type settings.
- Under Advanced settings:
- FieldA should be set to Hostname
- FieldB should be set to Request URI
- Set the values for both Field A and Field B to (.*), which is an expression that captures all characters.
- Set the Output To –> Constructor option to Request URI and provide $A1$B1 as the value for that choice.
Your reports will now show:
In the earlier example, when I described linking from http://www.Storefront-A.com to http://www.Storefront-B.com/company/stores.php, www.example.com portion of your URL will be included at the beginning of your page URL in the Master Profile on Account C (UA-XXXXXXXXX-C).
As you can see there are a lot of moving parts to Google Analytics. Before you try to build an advanced scenario as one described, remember we’re to here to help. Feel free to post any questions or suggestions you have in the comments below.