Search code examples
restgoogle-analyticsgoogle-apigoogle-analytics-apigoogle-reporting-api

Google Analytics Reporting API v4: Difference in return values for same period


I trying to perform request for specified date range.

For example: from 1 May 2017 till 5 May 2017

I do it in two ways:

First way: one request with date range:

2017-05-01 ~ 2017-05-05

Second way: four requests with date ranges:

2017-05-01 ~ 2017-05-02
2017-05-02 ~ 2017-05-03
2017-05-03 ~ 2017-05-04
2017-05-04 ~ 2017-05-05

As I expect the total sum of metrics (ga:sessions, etc) should be equal.

I.e. total number of sessions in first way should be equal to the sum of sessions from second way:

sessions from 2017-05-01 ~ 2017-05-02 +
sessions from 2017-05-02 ~ 2017-05-03 +
sessions from 2017-05-03 ~ 2017-05-04 +
sessions from 2017-05-04 ~ 2017-05-05 

But this is not true.

Sum of sessions in second way much bigger.

What is the reason?

Actually, results from GA API are not sampled (no reportData.samplesReadCounts or resportData.samplingSpaceSizes fields in response).


Solution

  • I suppose that your date ranges should be exclusive, e.g. 01-02, 03-04 and so on. Try add ga:datehour to inspect particular differences