Asynchronous Rollup Tracking in Google Analytics
We all know that each website should have it’s own dedicated Google Analytics account.
For people and businesses that run a number of sites – say more than 10 – you may wish to create what’s called a rollup tracker or “catch-all” tracker. This is a secondary Google Analytics account or profile and modified tracking script that goes on all the network sites.
The idea is this will provide a single place to look to see all the traffic hitting the network, and allows you to see what the top pages and sites are, see traffic moving between the sites and even can be setup to hold the original traffic source cookies as you move between two sites in the network.
Say you have the HQ website (www.examplehq.co.nz) and the branch office website (www.auckland-office.co.nz) which both have individual trackers, and the sites are interlinked somewhat through a branch locator directory page say.
All the traffic coming from HQ to the branch office will appear as referral traffic from www.examplehq.com and the branch site will never see the original keywords or referral sources that sent the traffic in the first instance.
With a rollup tracker and cross domain tracking enabled on the link, and with the dedicated branch tracker _allowLinker set to false, the status quo would still occur in the dedicated profile, but in the rollup tracker with _allowLinker set to true, the original traffic source cookie would be pulled through to the rollup tracker.
This would allow the branch office to see more clearly the traffic sources. Assuming the branch site gets a significant amount of traffic via these links, it could provide some valuable insights for them, and allow further optimisation for SEO and other marketing purposes.
So how does one implement such a system?
Using the asynchronous script, just under the the _gaq.push commands for the primary tracker, but before the function with the document.createElement methods, you simply add the following code:
// START ROLLUP TRACKER PUSH SECTION
); // END ROLLUP
Replace UA-12345678-1 with your 2nd rollup tracker account ID.
Note that any custom virtual pageviews, event tracking, and ecommerce tracking will not work in the rollup.
Those will all need to have additional lines added that reference the rollup tracker object.
For example, calls to create a fake pageview of /virtual/hello-world like _gaq.push([‘_trackPageview’, ‘/virtual/hello-world’]); would need to also include a line like _gaq.push([‘rollup._trackPageview’, ‘/virtual/hello-world’]);
Custom Filter to make sites seem like folders
Due to the fact that sites re-use page names such as /index.html, it would become confusing knowing which hit was which.
Therefore, it is recommended to add a custom filter to take the domain of the site being accessed, and to pull this into the Request URI, so that instead of recording hits in both /index.html for both the HQ and branch office, the inbound requests are relabelled with the domain at the start so the HQ hit becomes www.examplehq.co.nz/index.html and the branch office becomes www.auckland-office.co.nz/index.html
How to make the filter
This filter should only be applied to the rollup tracker profile.
Move to the admin section, click the profile for the rollup tracker, click filters, new filter.
You’ll want to make it look as follows:
Asynchronous Rollup Tracker Custom Filter To Add Hostnames to Pages
For reference the settings are:
Filter name: Add Hostnames
Filter type: Custom filter / Choose Advanced (radio button)
Field A -> Extract A drop-down menu set to Hostname field value is: (.*)
Field B -> Extract B drop-down menu set to Request URI field value is: (.*)
Output To -> Constructor drop-down menu set to Request URI field value is: $A1$B1
Field A Required: Yes
Field B Required: Yes
Override Output Field: Yes
Case Sensitive: No
And then click Save.
You will now see domain names in the Top Content reports as page names now include domains.