A quick guide to rollup style reporting with Google Analytics

 

Google Analytics is an excellent tool for monitoring website usage and gaining insight into content performance. Arguably it's the industry standard when it comes to hosted analytics platforms - especially as it's free. It can however, become a little tricky to manage multiple web properties across different domains. We often get asked how web admins can get a view of how multiple properties are performing as a whole. To do that, some form of rollup reporting is needed.

Here is a quick example to illustrate our standard solution; Dave Clientson has two websites;

  • www.davescakes.co.uk
  • www.davesbiscuits.co.uk

As anyone who has ever been involved in the Jaffa Cake argument will tell you, cakes and biscuits are two very different things.

Dave's Digital Marketing Manager, Donald recognises this, and has split the web presence into two separate sites accordingly - each site specifically tailored to meet the specialist needs of the target market. The current Google Analytics setup therefore looks like this:

This setup allows Donald to supply in depth reports and analysis for each site at the weekly board meeting. Donald has impressed Dave over the last few months with increasingly detailed presentations, including a demonstration of new real time analytics features, and funnel visualisations of PPC campaign goals & conversions. In short, Donald's prospects for a well deserved pay increase are looking good.

However, Dave suddenly wants to know how both sites are performing overall. He has got used to high quality reporting with advanced data visualisation, so Donald cannot simply export some pageview data to excel, add it together and bodge up a graph.

Palming off the task to the unpaid intern isn't an option either (on account of Gerald being both Dave's nephew - and totally incompetent). To secure the pay rise, Donald either has to embrace sleepless nights and caffeine abuse, or master rollup reporting.

The concept behind rollup reporting is simple - data from all websites, subdomains and associated properties is "rolled up" into a single account that we normally call the "Aggregator". The aggregator account is then used in exactly the same way as a normal analytics account - however, the resulting reports are created from data summed across all web properties.

Step 1 - Create an "Aggregator" property

Under the "Admin" pane for the desired account (as shown above), click the "New Property" button. Create an aggregator account as follows, use any of the site URLs in the URL field. 

 The properties list now looks like the following

Step 2 - Add field for aggregator user agent id to umbraco

If you are using a content management system, such as Umbraco, you most probably have the Google Analytics user agent id for the site stored somewhere in the CMS. It is also a good idea to also add a field for the aggregator so this can easily be updated in future if needs be.

 The User Agent ID's can be found on the property admin pane; e.g. 

Step 3 - Update tracking code on sites

Now the google analytics tracking code needs to be modified to push interactions into both the original account and the aggregator account. If you are using Umbraco, the following code snippet should do it for you - just update the field names to the appropriate Umbraco property aliases.

<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', '<umbraco:item Field="googleAnalyticsAccountNumber" runat="server" recursive="true"/>'],
['_trackPageview'],
['t2._setAccount', '<umbraco:item Field="googleAnalyticsAggregatorAccountNumber" runat="server" recursive="true" />'],
['t2._trackPageview']
);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

Alternatively, if you are not using Umbraco, replace the tags in the above code block with the necessary user agent ID's directly.

Step 4. Update any event tracking or e-commerce tracking codes

Any event tracking or e-commerce tracking code will also need to be updated to push to both accounts. For example, the following code snippet raises an event when someone clicks on a link to a PDF;

jQuery('a[href$=".pdf"]').click(function () {
           _gaq.push(['_trackEvent', 'Download Literature', 'Click', this.title]);
       });

this would become

jQuery('a[href$=".pdf"]').click(function () {
            _gaq.push(['_trackEvent', 'Download Literature', 'Click', this.title]);
_gaq.push(['t2._trackEvent', 'Download Literature', 'Click', this.title]);
        });

You may want to adjust the second line to also push the site hostname if needed as this could make more sense in aggregate reports.

Step 5. Set up domain filters on aggregator property

This is a useful step if the source of the interaction needs to be explicitly clear in the aggregator account. For example, if nothing is done, Google Analytics will treat "/contact" on both sites as the same page and will only display one corresponding line in reports.

This might be useful behaviour if the content of the sites is very similar. However, if the situation is similar to Dave's, then the content is very different across both sites, so it makes sense to know where the referrals are coming from.

This can be achieved by applying a filter to the aggregator property's default profile which will append the hostname to the location of all interactions. "/contact" interactions therefore become "www.davescakes.co.uk/contact" and "www.davesbiscuits.co.uk/contact" respectively.

Firstly, navigate to the "filters" pane of the default profile on the aggregator property




Click the "new filter" button and apply as follows

This basically modified the request URL field of every interaction that comes into Google Analytics by appending the hostname to the front. We will therefore be able to see immediately whether this was a cakes or biscuits interaction.

Conclusion

Rollup reporting with Google Analytics can give content owners quick and powerful insight into how web presences are performing as a whole. The technique is compatible with existing advanced implementations that involve event tracking or e-commerce.

Luckily Donald was able to master rollup reporting by Tuesday morning, and therefore had 4 days worth of high quality data & visualisations to show Dave at the Friday board meeting. Dave was impressed, one thing lead to another and Donald's pay rise was secured.

Further reading

This blog post is excellent for a few more advanced techniques on sub domains and e-commerce tracking. It is quite an old post now so the examples reflect the old analytics UI, however, the principles are the same.