The discovery & benefits of using ga:dataSource in Google Analytics

By Martijn Scheijbeler Published January 26, 2017

As there is always something new to learn in this world I recently came across (by a tip from Simon Vreeman) the dimension: dataSource in Google Analytics. It’s one that isn’t very well known, as it’s not available through any of the default reports, but can help bigger companies with integrations in multiple places in a great way. In our case it was incredibly useful to make reporting on AMP performance more easy.

DataSource is meant to provide an additional field to send where you’re sending the data from. But it’s different from a hostname or page path because it’s more about the source. By default it will always send the value: ‘web’ for sites, ‘app’ for mobile apps and apparently ‘amp’ for AMP tracking. Something that, in our case, was very valuable as traffic on AMP pages can be hard to find as a bulk. Filtering on pages that have ?amp or /amp/ as a pageview ain’t great if you want to see the traffic sources for 1 specific article. With LinkedIn also supporting AMP that won’t make it easier. Discovering dataSource makes it easier for us to kill a custom dimension to set the dataSource and immediately being able to filter down on this and then on referral traffic.
How you can leverage it? Send data from a specific source, for example your CRM, data warehouse or your email campaigns. We’re sending for The Next Web a hit to Google Analytics via the measurement protocol to track email opens. We’ll probably move this over as we would see it as a different dataSource then it being a ‘web’ hit.

How to configure the dataSource

Google Tag Manager: You can easily set it up in Google Tag Manager by creating an additional field that you can set, apparently it’s so unknown that it isn’t covered in the default field that are suggested. But if you add ‘dataSource’ as a field and enter the value (in this case a hardcoded value, but I would recommend going with a GTM variable).

Google Analytics: Setting this up in Google Analytics works in about the same way, you can add it as an additional field in your hit call to GA to set it by adding it like this.

@GoogleAnalytics: I know you’re reading this, please help us and update the documentation to also mention ‘amp’ being a default data source for tracking on AMP pages.

How to report

Creating a custom report

As the dimension isn’t available through a standard report you’ll have to create a custom report to do so. With our data I created a report like this that can be used to report on where traffic is coming from specifically (I’ll talk about the hit referral path in another blog post).

Look at this table ? with information about the dataSource dimension