Consolidate traffic data from multiple sites/apps in Google Analytics

If you own multiple websites, you’ve often wondered how to consolidate traffic data from all your Web properties (or apps) into a single view – besides Excel, that is!

Here is a quick guide on how to get this setup on all your sites, whether you use a tag management system or in-page tagging.

Let’s start with the basics

First off, this method is not new but seeing how many requests I get about setting up that kind of reporting, it was a good occasion to write up a guide 🙂

For Google GMP/360/Premium customers

You can use the Roll-up Property feature to achieve similar results. Ask your account representative to assist you.

For the first phase of this exercise, when we choose to consolidate traffic data, let’s start with the assumption that we only want high-level data because fine-level consolidation can cause issues.

Depending on your company’s jargon, you will want to differentiate between a “global” or “roll-up” property (where the consolidation happens) and a “local” account (limited to each site/app).
In this case, and for the purposes of this exercise, let’s say we got UA-123456789-1 as our new “global” property ID to consolidate traffic data across all our properties.

Let’s assume you use the following Google Analytics properties:

“Local” Site“Local” Property ID“Global” Property ID

As you can see, depending on how much control/governance you have over your websites, you may have created different Google Analytics accounts and/or properties so hopefully when we consolidate traffic data, we’ll have a single data silo (property) to store everything. Great idea, right?

Setting up Google Analytics

Let’s start by setting up the property that will collect all the data. Assuming you already use more than one account for your online properties, let’s choose to use a new account just to consolidate traffic data:

  1. Go to Google Analytics
  2. Go to the Admin panel
  3. Create a new account and go through the property creation process
  4. Grab the new tracking code and/or property ID
Consolidate traffic data in Google Analytics to send data into a single account/property
Go to the GA admin panel and create a new account

Next, because our URL/screen structure may differ from site to site, let’s create a filter to replace the URL captured by Google Analytics with each site’s domain name or hostname. In Admin panel, go find your view and create a new filter (custom, advanced) with the following settings:

  • Field A: Hostname: (.*)
  • Field B: –
  • Output field: Request URI: $A1
Consolidate traffic data in Google Analytics by using a filter to store hostname instead of URLs
Use hostname as a virtual URL to consolidate traffic data

Great! That’s all there is to it – for now!

Now let’s adjust our tracking on all our websites to account for consolidation. It can be done easily using a tag manager (such as Adobe Launch, Google Tag Manager, Matomo, Tag Commander, Tealium…). If you still use page-based tracking code you will see this is not rocket science but can imply heavier changes. Let’s explore each method separately.

Using a tag manager to consolidate traffic data

Because you will more easily be exposed to the Google digital marketing ecosystem, this blog post will use Google Tag Manager but you can easily replicate this exercise with another TMS.

The easiest way is to create another Google Analytics tag for your roll-up property that fires along the same trigger as your “local” page view:

Consolidate traffic data in Google Analytics by sending two page view calls

Of course this means specifying your new roll-up property ID in the tag definition, either as part of a Google Analytics Configuration Variable and/or as a “constant” variable to be used in a plain GA pageview tag or as part of said GA Configuration Variable:

Consolidate traffic data in Google Analytics by sending data to a roll-up property
Creating a variable containing the roll-up property ID to be re-used later

Using the roll-up property ID in a Google Analytics configuration variable:

Consolidate traffic data in Google Analytics by sending data to a roll-up property

Our roll-up pageview tag is now pretty simple – just use the configuration variable! We will come back this topic later for advanced roll-up reporting.

Consolidate traffic data in Google Analytics by sending data to a roll-up property
Make sure you use the GA Settings variable – it will save you tremendous amounts of time!

Great, now go ahead and publish your container and automagically receive GA data in your roll-up property!

Extra credit: using Google Analytics’ customTask instruction

Google Analytics provides a robust JavaScript API with methods (tasks) to process data before it is sent to Google Analytics collection servers. One of these tasks is customTask, which you can use to do just about anything, including sending your Google Analytics payload (data) to more than one property by repeating a page view or an event.. I started fiddling with that notion but Simo was already writing about it 😀

In GTM, you’ll want to create a Custom JavaScript variable called GA Duplication with the following code:

function() {
  // Replace newTrackingId value with the UA property to which you want to duplicate this tag
  // or use the GTM variable placeholder
  var newTrackingId = {{ID - Google Analytics - Roll-up}};  
  var globalSendTaskName = '_' + newTrackingId + '_originalSendTask';
  return function(customModel) {
    window[globalSendTaskName] = window[globalSendTaskName] || customModel.get('sendHitTask');
    customModel.set('sendHitTask', function(sendModel) {
      var hitPayload = sendModel.get('hitPayload');
      var trackingId = new RegExp(sendModel.get('trackingId'), 'gi');
      sendModel.set('hitPayload', hitPayload.replace(trackingId, newTrackingId), true);

Then use that variable as the hitCallback parameter in the Fields to Set section of your “local” GA tag:

Consolidate traffic data in Google Analytics by using a customTask via Google Tag Manager

Publish your container and bam! Double tracking! This solution is a lot more elegant (minimal effort and more inclusive) and does not require as much work. I encourage you to try this approach and read up on Simo’s post on the topic.

Using page-based tagging to consolidate traffic data

If you’re not a fan of tag managers or can’t/won’t install GTM on your site, that’s fine too, I guess. Now you’re going to modify each page on your site to support your roll-up strategy. If you’re good with PHP, Python, Java or whatever language drives your site, you can easily adjust your page templates to include a second pageview call. Having said that, you’ll want to take a few precautions; for instance using a different tracker name for your roll-up tracker would be a good idea to avoid conflicts:

<!-- Google Analytics -->
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  ga.create('UA-12345-1', 'auto', 'local');
  ga('local.send', 'pageview');
  ga.create('UA-123456789-1', 'auto', 'global');
  ga('global.send', 'pageview');
<!-- End Google Analytics -->

In the above example for analytics.js, we are effectively duplicating the local pageview to the global property. If you use the global tag (gtag.js), the code now looks like this:

	<!-- Global site tag (gtag.js) - Google Analytics -->
	<script async src=""></script>
	  window.dataLayer = window.dataLayer || [];
	  function gtag(){dataLayer.push(arguments);}
	  gtag('js', new Date());
	  gtag('config', 'UA-12345-1', { 'groups': 'local' });
	  gtag('config', 'UA-123456789-1', { 'groups': 'global' });
	  gtag('event', 'Testing', { 'send_to': ['local','global'] });

In the above gtag.js code, you will notice you can create groups named after either the local or global tracker. The first two config calls send a pageview to each of the trackers separately but the event call is sending a GA event grouped call to both local and global. As you can imagine, you may need to re-tag your entire site, including events for clicks, eCommerce, etc.

Comparing methods

As I’m sure you gathered from the methods above, using customTask in GTM will save you a tremendous amount of time – assuming your properties and view are set up as identically as possible.

Pro tip

Whenever possible restrict development efforts by using a tag manager.

Viewing results in Google Analytics

Now that you’ve applied all my recommendations, you will start seeing roll-up data in your reports!

Consolidate traffic data in Google Analytics by listing each site individually
The above table shows each of my site as “pages”, each with it’s own set of metrics

As you can see from the example above showing some of my own sites, this makes for quite the useful report!

This also means you can use Behavior Flow reports to see if your users navigate from site to site – assuming you set up cross-domain tracking.

And of course, this makes for awesome real-time dashboards:

Consolidate traffic data in Google Analytics in a realtime dashboard!

Next steps

If you haven’t already done do, you should be using a data collection plan that is common across all your sites, or at least that provides a common measurement framework for most sites, with some flexibility for some sites.

This means making sure all your properties have the same setup when it comes to custom dimensions and metrics for instance: you don’t want to send irrelevant dimension data! This is one of the tremendous benefits of using the customTask method: you don’t need to redefine a Google Analytics Settings variable or redefine all custom attributes for the roll-up tracking call because it is going to inherit the attributes from the original call to the local property.

Here is a checklist to consolidate traffic data across properties:

  • Review custom dimensions and metrics. If you have a large number of sites and dimensions/metrics, use my Python script or Simo’s Google Sheet.
  • Review Remarketing and demographics settings: you may not be able to send targeting data the same way across sites.
  • Maintain a list of sites and Google Analytics properties, assuming you share access using the same Google Analytics user account. You can also use the Google Analytics Management API for that

When should I worry about this?

Ideally, you should plan for this kind of tracking early when deploying multiple websites, it will make your life easier. But as we all know, projects can be tricky and you end up adding more tracking later one.

If you’re going to start out and not plan for consolidation right away, try to aim for simple tracking at the beginning before tacking on more tracking elements across all sites.

Just remember that it’s always more expensive if you do it later 🙂

In closing

Have you deployed multi-site tracking to consolidate traffic data across sites and apps?

What hurdles did you face? Did you identify success factors? Let me know in the comments!

Author: Julien Coquet

Expert de la mesure d’audience sur Internet depuis plus de 15 ans, Julien Coquet est consultant senior digital analytics et responsable produit et évangélisation pour Hub’Scan, une solution d’assurance qualité du marquage analytics. > A propos de Julien Coquet

7 thoughts on “Consolidate traffic data from multiple sites/apps in Google Analytics”

  1. Hey Julien!

    You talk early in the article about the fact that a roll-up property may only be able to track high level data and that fine-level data may cause problems.

    What kind of data will we be missing?

    I have a few subdomains I need to track and I want to ensure I can track the same users across multiple subdomains. Obviously having these subdomains in the same property would be easiest, but I want the organizational benefits of placing them in their own properties and then creating the roll-up as well. However, I dont want to do this at the cost of valuable data.

  2. Hi, this is one of the rare posts detailing pretty well how to create a rollup property with GTM. I’m not very good with javascript, but i’ll still ask. The example with the CustomTask (from Simo) works if we add only 1 new property to the rollup. But how would this look like if we had let’s say one or two more property to add? i just wonder how this custom javascript would look like. Thx.

  3. Hi, this a great. How is it possible to combine traffic from different pages with ga4? Have you done this or do you know how?

    1. Hi Michael,
      GA4 will have rollup properties and subproperties where GA360 is enabled.
      For free properties, you’ll have to use multiple tags to send data to multiple properties. This is made easier if you use Google Tag Manager.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.