Google Data Studio “Mini Tip” – Set A “Sampled” Flag On Your Reports!
Google Data Studio “Mini Tip” – Set A “Sampled” Flag On Your Reports!
Google’s Data Studio is their answer to Tableau – a free, interactive data reporting, dashboarding and visualization tool. It has a ton of different automated “Google product” connectors, including Google Analytics, DoubleClick, AdWords, Attribution 360, Big Query and Google Spreadsheets, not to mention the newly announced community connectors (which adds the ability to connect third party data sources.)
One of my favourite things about Data Studio is the fact that it leverages an internal-only Google Analytics API, so it’s not subject to the sampling issues of the normal Google Analytics Core Reporting API.
For those who aren’t aware (and to take a quick, level-setting step back) Google Analytics will run its query on a sample of your data, if the conditions match these two circumstances:
- The query is a custom query, not a pre-aggregated table. (Basically, if you apply a secondary dimension, or a segment.)
- The number of sessions in your timeframe exceeds:
- GA Standard: 500K sessions
- GA 360: 100M sessions
(at the view level)
The Core Reporting API can be useful for automating reporting out of Google Analytics. However, it has one major limitation: the sample rate for the API is the same as Google Analytics Standard (500K sessions) … even if you’re a GA360 customer. (Note: Google has recently dealt with this by adding the option of a cost based API for 360 customers. And of course, 360 customers also have the option of BigQuery. But, like the Core Reporting API, Data Studio is FREE!)
Data Studio, however, follows the same sampling rules as the Google Analytics main interface. (Yay!) Which means for 360 customers, Data Studio will not sample until the selected timeframe is over 100M sessions.
As a quick summary…
Google Analytics Standard
- Google Analytics UI: 500,000 at the view level
- Google Analytics API: 500,000
- Data Studio: 500,000
Google Analytics 360
- Google Analytics UI: 100 million at the view level
- Google Analytics API: 500,000
- Data Studio: 100 million
But here’s the thing… In Google Analytics’ main UI, we see a little “sampling indicator” to tell us if our data is being sampled.
In Data Studio, historically there was nothing to tell you (or your users) if the data they are looking at is sampled or not. Data Studio “follows the same rules as the UI”, so technically, to know if something is sampled, you had to go request the same data via the UI and see if it’s sampled.
At the end of 2017, Data Studio offered a toggle to “Show Sampling”
The toggle won’t work in embedded reports though (so if you’re a big Sites user, or otherwise embed reports a lot, you’ll still want to go to the manual route), and adding your own flag gives you some control on how, where & how prominently any sampling is shown (plus, the ability to have it “always on” rather than requiring a user to toggle.)
What I have historically done is add a discreet “Sampling Flag” to reports and dashboards. Now, keep in mind – this will not tell you if your data is actually being sampled. (That depends on the nature of each query itself.) However, a simple Sampling Flag can at least alert you or your users to the possibility that your query might be sampled, so you can check the original (non-embedded) Data Studio report, or the GA UI, for confirmation.
To create this, I use a very simple CASE formula:
CASE WHEN (Sessions) >= 100000000 THEN 1 ELSE 0 END
(For a GA Standard client, adjust to 500,000)
I place this in the footer of my reports, but you could choose to display much more prominently if you wanted it to be called out to your users:
Keep in mind, if you have a report with multiple GA Views pulled together, you would need one Sampling Flag for each view (as it’s possible some views may have sampled data, while others may not.) If you’re using Data Studio within its main UI (aka, not embedded reports) the native sampling toggle may be more useful there.
I hope this is useful “mini tip”! Thoughts? Questions? Comments? Cool alternatives? Please add to the comments!