Jimmy Adaro
Jimmy Adaro

Reputation: 1405

Analytics Core Reporting API suddenly differs heavily from dashboard data

I'm using Google API PHP Client to get Google Analytics data. So far so good until yesterday, when the data from the created report started to differ from the data on the Analytics dashboard. Previously, all data matched from dashboard and API results without any issues.

So, if my 30-days report (StartDate = 30daysAgo, EndDate = today) has 118,000 pageviews on dashboard, it returns 78,300 on API batchGet. Same for my others metrics, sessions and newUsers.

Everything still wrong even after setting the sample level to LARGE and setting the page size to 50000 (v4 allows up to 100,000). It used to work perfectly on DEFAULT and 10000, I can't understand then what is wrong now!

I didn't see any error alert any about quota on Cloud Platform project nor on Analytics dashboard. This still in local development environment tho.

Upvotes: 0

Views: 542

Answers (1)

zborovskaya
zborovskaya

Reputation: 1143

It looks like the cause is sampling. This can be associated with an increase in traffic on the site as a whole.

General thresholds for sampling: 500k sessions at the property level for the date range you are using. https://support.google.com/analytics/answer/2637192

Sampling level LARGE does not mean that sample is 100%. https://developers.google.com/analytics/devguides/reporting/core/v4/basics?hl=en#sampling

Check fields samplesReadCounts and samplingSpaceSizes in your Core Reporting API 4 response. If they are empty, sampling hasn't been applied. https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet#ReportData.FIELDS.samples_read_counts

To avoid sampling try to reduce the date range.

Upvotes: 1

Related Questions