Roll Up Property - Multiple Google Analytics Trackers on the page

How many digital properties do you have?

Usually it's one for each website and two (Android & iOS) or three (Window Phone) for Apps. Additionally you may have a separate iOS tablet version of an App. Any business large enough will easily end up having 6-10 Properties with 3 to 10 Views in each. If you are running multiple websites, your numbers might be even higher. In addition, you would, as a real Analytics Ninja, separate Social and Organic traffic, keep your Paid Search traffic in different Views; and create Views for each of your sub-sites and sections inside mobile Apps.

Roll_Up_Property_-_Multiple_Google_Analytics_Trackers_on_the_page_image_1

So now your properties are nicely structured, all data with noise filtered out in the right place - you can easily report on each individual section and you are feeling good. But what if you need to report on some of your websites combined? Or what if the marketing team is worried about mobile Apps performance and requires a report which links iOS (including Tablet) and Android data?

Sure, you can do that by crafting a report in Tableau or Excel manually linking data sets or use any other method for data processing. But honestly, would you do that? Probably not. If you are an Analytics Ninja you will probably create a Roll Up Property which will aggregate data from all or most of your Digital Properties allowing for fast and efficient combined reporting.

But do you need to be a ninja to create a Roll Up Property? Absolutely not! If you are a happy owner of Analytics 360 (formerly Google Analytics Premium) licence, just a few clicks from your Analytics 360 reseller and you are set. If not - you can still do it yourself.

Who said you could only have a single Google Analytics trackers on a page? Right, with Universal Analytics you can have more than a few and you are only limited by common sense: it's all JavaScript, so performance of your client browsers has its limits. Just add a second GA tracker to every page for all of your websites, modify tagging a bit and it will work. But who is using manual tagging these days anyway?

I am going to help you to create a Roll Up tracker in your Google Tag Manager (GTM). If you are not using GTM yet, I strongly encourage you to start using this great tool which makes website and App tagging easier and more effective.

There two ways, as always.

  • Duplicate your tags for each Google Analytics ID.
  • Get your hands dirty with JavaScript.

The first option is slower, requires lots of mousework and is extremely hard to maintain afterwards.
Since I am a big fan of getting hands dirty, let’s follow the second way. Why did I mention the first one at all? Well, if all you need is 2 or 3 Google Analytics Pageview tags (one per account) on every page with no additional tracking, the JavaScript option is definitely an overkill - just create those tags and never come back! But please, continue reading, out of curiosity :)

In short: you are going to trigger GA Pageview and GA Event tags manually from a Custom HTML tag with JavaScript for each GA Account you want to track. We will trigger events and pageview tags by pushing into dataLayer current GA ID and other required data.

Getting hands dirty
  1. Create constant Variable for each GA Account ID. Please give them meaningful names like: GA ID and GA ID Roll Up
  2. Create Custom JavaScript Variable named GA IDs which will return a JavaScript Array with all your just defined GA IDs
    function(){ return [ {}, {} ]; } 
  3. Create GA ID from DataLayer Data Layer Variable with the same name
  4. Create Custom HTML Tag and name it GA Pageviews
    <script> var arGAIDs = {}; //read all GA Property IDs we need to report on for(var i = 0; i < arGAIDs.length; i++) { //for every GA Property ID do a data layer PUSH using our custom event dataLayer.push({ 'event': 'irx.fireGAPageview', 'GA ID from DataLayer': arGAIDs[i] }); } </script> 
  5. Now, let’s create a Universal Analytics tag which is triggered by our custom event irx.fireGAPageview (not All Pages) and the trick is to set the {} variable as a Tracking ID
    Roll_Up_Property_-_Multiple_Google_Analytics_Trackers_on_the_page_image_2
  6. Try it. You will see that a GA Pageview tag is triggered for each account you have specified in GA IDs Variable.

Test it and publish. Just like that, you are magically using GTM to push pageviews data to your Roll Up account.

What about Google analytics Events? The same applies:

  1. Again, create the following Data Layer Variables where Variable Name equals Data Layer Variable Name
    1. GA Event Category

    2. GA Event Action

    3. GA Event Label

    4. GA Event Value

    5. GA Event Non-Interaction

  2. Create a Custom HTML Tag that is triggered by JavaScript Error or Link click (for example) and name it for example: Fire Multiple Events (I am sure you could come up with a much better name)
    <script> var arGAIDs = {}; //read all GA Property IDs we need to report on for(var i = 0; i < arGAIDs.length; i++) { //for every GA Property ID do a data layer PUSH using our custom event dataLayer.push({ 'event': 'irx.fireGAEvent', 'GA ID from DataLayer': arGAIDs[i], 'GA Event Category': 'YOUR EVENT CATEGORY', 'GA Event Action': 'YOUR EVENT ACTION', 'GA Event Label': 'YOUR EVENT LABEL', 'GA Event Value': 0, //or any integer or undefined 'GA Event Non-Interaction': true //if you wish to leave your bounce rate unaffected }); } </script> 

    As you can see, this is very similar to what we did before. For each GA ID, we push custom event with its data into the dataLayer
  3. Let’s create an actual GA Event which is triggered by our custom event irx.fireGAEvent
    Create a Google Analytics Tag with Event Track Type, trigger it by event named irx.fireGAEvent and use your just created variables as parameters for the Event. Set Tracking ID to {}, Category to {}, Action to {}, Label to {}, Value to {}, Non-Interaction Hit to {} variable
    Roll_Up_Property_-_Multiple_Google_Analytics_Trackers_on_the_page_image_3

  4. Test it (always test it) and publish.

Easy, isn't it? With a few modifications to a single JavaScript in our Tag you could easily put only part of your website or App into the Roll Up Property without re-publishing your website at all!

The Roll Up reporting is actively used when you are required to report on a multiple digital property. Roll-Up reporting is actively used in Internetrix Government Analytics solution for federal and state government of Australia

Add Your Comment

No one has commented on this page yet.