I will show you 2 approaches that will fix sampled data in your Google Analytics reports – also when you are using the free version of Analytics.
Long time period + lots of dimensions = sampled data
If we have a situation where we want to report over a long time period for different dimensions we normally run into sampled data. For some cases, e.g. when you look at conversion data, this will give you just wrong numbers and lead to wrong actions. For that reason I highly recommend to always look at the “containsSampledData” field in the API Response if using the reporting API for fetching data. But which workarounds do we have if we get sampled data?
Use partitions over time to avoid sampling
Let’s say we want to look at a full year of reporting data and our api request is showing us that we have sampled data in the response the solution is to make more requests with smaller time periods and sum up all results in the end. In our example we would split the single request to 365 requests, one per day, and sum up the results. Job done!
This will work fine for the free Google Analytics and also for the premium version. Yes, you can access raw data in big query in analytics 360 – but sometimes the query statements become quite tricky on nested fields and it is more convenient to just use the API.
In the past you had to write also the clientID to a custom dimension but it is now available in reports by using “ga:clientId”. Currently the API documentation does not tell you about this.
Share on Twitter
Expert tip for the Google Analytics free version: daily loading strategy for accessing raw data in big query
Ok – we already learned that we get unsampled data when we use daily partitions. But when using the API we still have the limitation of only 7 different dimensions per report.
To get real raw data over all dimensions we have to use another tweak. We will split up the requests for all dimensions we need. For every request we have to add the clientID and a custom dimension filled with the timestamp of the hit. On those two keys we can join the different tables in big query and we have raw data for all dimensions. Pretty cool, isn’t it?
Hint: In the past you had to write also the clientID to a custom dimension but it is now available in reports by using “ga:clientId”. Currently the API documentation does not tell you about this.
This approach is very good for power users with a lot of reportings over time and different dimensions.
If you don’t have developer background and still want unsampled data without doing all the stuff manually, feel free to get in touch with us.
Cheat Sheet
- Always look at the “containsSampledData” field in the API Response if using the reporting API for fetching data.
- You can access raw data in big query in analytics 360 but when query statements become tricky on nested fields, it is more convenient to use the API.