Roll up reporting in Google Analytics
Hacks March 30th, 2009
Roll up reporting is not a standard feature in Google Analytics. However with a little extra coding, you can have stand alone reports for specific i.e. product dedicated websites, and a roll-up report to give a global overview.
Generally, this issue mostly effects enterprise clients. For example, companies with brand specific or product specific web sites targeted at particular markets. Because of this specific need it makes sense to have separate, stand alone Google Analytics accounts for each web site. That way, segmentation, referral analysis, e-commerce revenue (or lead generation) can be analyzed in detail.
However, Marketing Managers also need a high level overview of how the entire online channel is performing. This is when having separate GA accounts can become laborious. Roll-up reporting simplifies this. That is, in addition to individual Google Analytics accounts, you also have a single "catch-all" account with all data from all web sites aggregated. This post shows you how to do this and was recently successfully deployed by Unicef.org.uk .
What exactly is the advantage of this approach compared to using a single profile and then creating additional sub-profiles for each site?
For enterprise clients I generally come across the scenario where the client has semi-autonomous country offices who wish to “play” (segment, filter, open up access to their agency) with their own specific data. The HQ requires a global overview but wish to leave the country/region details to the local office. In fact, they generally wish to leave all training, support and management of analytics to their local office – HQ provides the implementation.
To ensure HQ receives its global overview with confidence in its data integrity, it is better that they maintain their own GA account with access restrictions and change history documentation in place. Country offices can then do as they wish.
Roll-up reporting setup
The principal to roll-up reporting is straight forward – you add multiple Google Analytics Tracking Codes (GATCs) to your web pages. One specifies the individual account, the other is for the roll-up account. Schematically this is shown below for two websites:
<script>
Call the standard GA loader script
</script>
<script>
1. Track the pageview into the individual account
2. Track the pageview into the roll-up account
</script>
The actual JavaScript is as follows:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var firstTracker = _gat._getTracker("UA-123456-1");
// Acc. for mysite.com firstTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-987654-1");
// Acc. for catch-all secondTracker._trackPageview();
</script>
Note, for each stand alone web site, you use your specific GATC i.e. change the UA-123456-1 to match each of your Google Analytics accounts. Below this, you add the same same roll-up account information. The rollup part of the GATC remains the same for each site. In this case UA-987654-1. Obviously you will need to change the UA numbers for your account(s).
E-Commerce
Special consideration is required for e-commerce transactions because you will need to call the e-commerce tracking code for each account. So _addTrans, _addItem and _trackTrans are required for firstTracker and secondTracker objects. Schematically you need to add the following on your transaction receipt/confirmation page (view the Help Centre if you need general e-commerce tracking help):
firstTracker._addTrans(enter transaction values as array);
firstTracker._addItem(enter item values as an array);
firstTracker._trackTrans();
secondTracker._addTrans(enter transaction values as array);
secondTracker._addItem(enter item values as an array);
secondTracker._trackTrans();
And that’s it… except…
Roll-up implications
It is important you are aware of the ramifications of rolling up data from different websites into one Google Analytics account:
- Pageview aggregation
Pageviews in your different websites that have the same page title or name (for example index.htm, contact.htm etc.) will be aggregated. That is you will only see one entry for index.htm and for contact.htm etc., with the sum of their pageviews. Generally for roll-up reporting that is not a problem as this account is used to get the "big picture" aggregate overview. However, if you still need the page name detail, apply the filter described in the following Help Centre – its the same filter for differentiating pageviews from sub-domains . - transaction in different currencies
Similar to pageview aggregation, e-commerce data will be aggregated. That is, if you have transactions in different currencies the revenue totals become meaningless at the roll-up level. So pounds, dollars, euros are all be combined regardless of exchange rates. Therefore, for your roll-up account, unify your transaction data into a single "base" currency. This base currency should remain fixed so that long term comparisons can be made i.e. don’t change this to reflect currency exchange rates. - Timezone alignment
If your stand alone accounts operate in different timezones, ignore time of day reports in the roll-up account. They won’t make sense! - AdWords ROI in different currencies
If you run AdWords accounts in different currencies for your stand alone Google Analytics account, ignore the ROI and margin metrics from the ‘Clicks’ report. - Cookie manipulation
The roll-up report method described in this post results in cookies being shared between both of your Google Analytics accounts. Therefore any cookie manipulation on one (changing time out values, expiry date for example), results in changes impacting both sets of reports. This issue can arise for example if you have an agency collecting data for its own internal purposes (stand alone account) as well as for you (global account). They may wish to experiment, not realising the wider impact – I have seen this happen and a great deal of time and money was wasted trying to figure out what was going on!
These implications may sound daunting but in many cases they are not. Apart from unifying your e-commerce data, you probably will not drill down deep enough in a roll-up report for these implications to be noticed.
Improvement tip
This hack improves the pageview aggregation implication described above (item 1).
If you have dozens or even hundreds of product micro sites, you may wish to simplify pageview reports even further. Rather than collecting detail of every single page on each micro site into the rollup account, you can concertina this in to a "per site view". That is, rollup pageviews.
In this way, instead of having pageA = 3 views, pageB = 2 views, pageC = 1 view etc., you would have pageview for www.mysite.co.uk = 6, www.mysite.com = 13 etc. This simplifies the Top Content report, so that you see overall pageview volumes on a per site basis.
The following GATC modification can be used for simplifying pageview reports:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var firstTracker = _gat._getTracker("UA-123456-1"); // Acc. for mysite.com
firstTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-987654-1"); // Acc. for catch-all
secondTracker._trackPageview(location.host);
</script>
The highlighted line replaces the pageview name (URI) with the name of the website.
Please let me know if you found this article useful. A quick rating (click the stars) is the fastest way, though as always comments are my main KPIs.
No related posts.



(28 votes, average: 4.75 out of 5)


March 31st, 2009 at 11:47 pm
Great post; very straightforward. Clients ask us for this type of customization all the time.
On the aggregating pageviews point, it’s also possible to use secondTracker._trackPageview(location.host+location.pathname) rather than creating a filter to differentiate the pages.
April 1st, 2009 at 8:43 am
Hi Brian,
thanks for your explanation, great! like always.
Just, one question. It would be possible to use a different setVar for each tracker? Thanks.
Regards
April 1st, 2009 at 10:02 pm
Jared: Thanks for the feedback and good point for extending location.host method.
Manuel: As cookies are being shared only one instance of setVar can be used.
On a related note, if the site is running any kind of extension script to track downloads, outbound clicks, etc… or events, they will need to have those scripts also run the second tracker if they want to roll-up that data. Thanks to Caleb of AnalyticsPros for pointing this out.
April 3rd, 2009 at 6:46 am
Hi Brian, you have to leave out the quotes around location.host
Thanks for the idea though, great way to do roll-up reporting.
April 7th, 2009 at 10:02 pm
Andre: Well spotted and corrected. Many thanks.
April 11th, 2009 at 2:10 am
Hi Brian,
I have a quick question for you and I’m not sure where to put it, so I thought I’d leave it here.
How would I set up a filter that would distinguish Google Product Search referrals or plain old Google Organic?
Its a bit unclear what the specific URL Referral is of a product search link, but I am pretty sure it is just getting counted as organic.
I am in a situation where it would not be simple to tag all product feed links with ?utm_source parameters, so hopefully a filter will help me out here.
Thanks!
Eric
April 12th, 2009 at 10:37 am
Hi Brian
I have implemented this on a group of sites that we run and am loving the insightful reports that I can gain. Thanks for this one.
Nikki
April 14th, 2009 at 9:05 pm
Dear Brian,
Thank you for your book “Advanced Web Metrics with Google Analytics”, we expect it’s translation into Russian to be greatly useful for our colleagues. In Russia Web Analytics is not widely used yet.
The conference “Сybernetics and Business” is the most large-scale in Russia (5963 participants are registered at the moment, while the registration will be continued for a week http://ok2009.ru/participants/). Dmitry Medvedev, Russian president, visited it last year.
Some best Russian experts are to make their reports at the conference on the subject “The usage of web-analytics data for increasing sales of an online-shop” (http://ok2009.ru/program2/58/).
We would be glad if you agreed to be a reporter at the conference (on-line via skype or personally). It will be quite soon, though the date and time are not fixed yet. Anyway, any your report to the audience, including the announcement of the Russian translation jf the “Advanced Web Metrics with Google Analytics” will be discussed at the section.
A Russian association of Web Analysts is likely to take it’s origin at this section.
Alexey Yakovlev, the author of two popular Russian-language books on site promotion and context advertising, the leader of the well-known in Russia project http://www.seo-study.ru/, organizes free on-line seminars at http://www.onlinesem.ru/.
For example, a series of seminars is to take place soon. The seminars are devoted to the problems of usage of Google products and are supported by Google-Russia Company (http://www.onlinesem.ru/google.php). A seminar “Tracking with Google Analytics” will take place on 24 June 2009. Every participant would welcome you to take part in the seminar. If you would choose to make the report via Internet, Alexey Yakovlev could organize the translation into Russian.
We hope that you will accept our offer.
Once again thank you for your book.
Mihail
April 15th, 2009 at 9:08 am
Doesn’t Google disregard tracking multiple domains with one GA account. See the last paragraph – http://code.google.com/apis/analytics/docs/concepts/gaConceptsCookies.html
April 16th, 2009 at 10:03 pm
Jay: Your reference is correct. However that is not connected to this hack.
May 11th, 2009 at 7:10 am
Hi Brian, As usual very interesting post.. There is only one but, I don’t see the modifications I just see;
May 11th, 2009 at 1:26 pm
Emiel: Thanks for the heads up – its actually a bug in WordPress. If I edit a post containing sample code it must be done in HTML view. The wysiwyg editor messes the code and effectively wipes it..!
May 20th, 2009 at 12:20 pm
Very interesting article: I am dealing with a couple of enterprise customers who have several sites and a roll-up report is required. But what exactly is the advantage of this ‘double tagging’ approach, compared to using 1 single GA profile tag – and then creating additional sub-profiles for each site, using a filter based on host name ?
May 27th, 2009 at 10:39 am
Luc: Good question – this should be made clearer in my original post…
For enterprise clients I generally come across the scenario where the client has semi-autonomous country offices who wish to “play” (segment, filter, open up access to their agency) with their own specific data. The HQ requires a global overview but wish to leave the country/region details to the local office. In fact, they generally wish to leave all training, support and management of analytics to their local office – HQ provides the implementation.
To ensure HQ receives its global overview with confidence in its data integrity, it is better that they maintain their own GA account with access restrictions and change history documentation in place. Country offices can then do as they wish.
Finally, using multiple accounts allows you to overcome the 50 profile limit per account.
HTH.
July 22nd, 2009 at 1:14 pm
Hi Brian,
I have an enterprise client with GA accounts set up for 5 currencies ($US, GBP, $CA, $AUS, EUR), which track into a roll-up account (in GBP). Is it possible to apply a pre-defined exchange rate (e.g. £1 always equals $1.4) so that the second trackers translate the $/EUR figure, etc, into GBP for the roll up report. Hope that makes sense.
Thanks, Sam
August 3rd, 2009 at 9:57 am
Great Post! This is a much better solution than the usual multi-filter method to separate individual website data.
August 18th, 2009 at 5:20 am
Hi Brian,
This has been a big help in seeting our roll up accounts. We will be implementing this very soon on our websites. Just a quick question: Do you see any impact in website performance due to this multiple track code?
Thanks,
Vishal
August 18th, 2009 at 12:44 pm
Hi, Brian,
reading you book atm. Since it was published GATC seems to have changed a bit. Now it looks more like:
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
try {
var pageTracker = _gat._getTracker(“UA-########-#”);
pageTracker._trackPageview();
} catch(err) {}
Is it the right way to setup tracking for multiple accounts?
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
try {
var firstTracker = _gat._getTracker(“UA-########-#”);
pageTracker._trackPageview();
var secondTracker = _gat._getTracker(“UA-########-#”);
pageTracker._trackPageview();
} catch(err) {}
August 20th, 2009 at 2:33 pm
Sergey: yes you are correct. Look out for the second edition of the coming in early 2010…
August 20th, 2009 at 2:35 pm
Vishal: there is no additional performance impact of using this code as the ga.js file is only loaded once – no matter how many times you call pageTracker.
September 30th, 2009 at 12:59 pm
The post is nice.
This is new thing to learn in Google Analytics.
Thanks
October 8th, 2009 at 3:24 pm
Great post! Two things:
- Roll-up reporting is hitting the big time with a post on the official blog: http://analytics.blogspot.com/2009/09/advanced-structure-your-account-with.html
- Re: simplifying pageview aggregation — seems like a great fix, but rather permanent. Is there a way to do this via filters on a specific profile in your roll-up account?
December 11th, 2009 at 8:27 pm
Great information! It seems like I learn something new everyday with regard to Google Analytics. Learning how to track the information in more granular ways definitely adds value to the information received.
December 16th, 2009 at 9:35 pm
Great info! I have a question:How can different events (through ajax requests) in a page be used to create a consolidated report? For example, there are three events (ajax requests) that we want to rollup based on a day and give the metrics for all the three events on the columns. Not sure if the question is clear; if not I can further explain. Help in this regard would greatly help!!
December 17th, 2009 at 11:24 am
Thanks Brian, great post! I’ve implemented this across a few sites, and I’m a little unsure as to how to interpret the Absolute Unique Visitor data.
Will the roll up be able to de-dupe visitors across the different domains included within it?
e.g. If one visitor browses 4 of our sites in a day, will they be counted as 4 unique visitors, or 1 unique visitor in the roll up?
Is there an issue with cookies preventing this from happening?
Any info would be greatly appreciated!
December 18th, 2009 at 10:36 am
Jon: The method for roll-up reporting I describe is not suitable for your situation – it is aimed at organisations that have autonomous offices/websites.
For visitors that can traverse different websites, you need to use the methods described in Ch7 of the book, Advanced Implementation. Essentially you hand over cookies from one domain to another (using _link or _linkByPost functions) so that the session information is preserved. That way, the uniqueness is also preserved.
BTW, this post from me is also relevant for you: http://www.advanced-web-metrics.com/blog/2009/02/11/why-counting-uniques-is-meaningless. It doesn’t mean don’t use ‘uniques’ in your KPI mix, rather use them in context i.e. don’t give a lot of weight to them.
December 18th, 2009 at 10:41 am
Parthi: I don’t think your question relates to this post on roll-up reporting. It sounds like you with to group your ‘actions’ into ‘categories’. Event tracking can do this for you. You will need to plan the hierarchy of your events and then use the category label of the _trackEvent call.
The current book is a little out of date now on Event Tracking as it was only just in beta when written. The new edition is much more clear on this. Stay tuned…
January 13th, 2010 at 6:43 pm
Hi Brian, really helpful post. I’m utilizing the code you’ve supplied for tracking a country and a global account with the modification that can be used to simplify reports. When tracking multiple top level domains, Google recommends adding the following code snippets. Should we add the following code beneath var Firsttracker and var secondtracker?
pageTracker._setDomainName(“none”);
pageTracker._setAllowLinker(true);
January 20th, 2010 at 9:52 am
Ryan: The use of _setDomainName and _setAllowLinker are for tracking visitors that cross over between domains i.e. support.mysite.com and blog.mysite.com. If that is your scenario then this method of roll-up reporting is not for you (aimed at semi autonomous offices with separate sites). E-nor posted a GATC method for doing this: http://analytics.blogspot.com/2009/09/advanced-structure-your-account-with.html
March 17th, 2010 at 3:54 pm
Im using the regex you mention in this post
Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Constructor: $A1$B1
This allows me to see my sub domain which is good. However this also has the effect that I now see www. which is logical since it’s a sub domain. My question. Is there a way to filter out the www so it reports together with the non-www site.
April 28th, 2010 at 7:30 pm
Hi,
I have set up rollup profiles for my sites. But there is a mismatch between the data of Individual and roll up profiles. Though the difference between the individual and rollup account for a page is maximum 10 per day..The problem arises when we gather data for over a period of time.
June 22nd, 2010 at 12:20 pm
Has anyone got any tips/guides on how to do rollup reporting in GA using the new asynchronous tracking code?