GA total results is significantly less with hour d

2019-08-01 05:30发布

I am using the GA API running two queries over 1 year's worth of data:

Query1:

Get apiQuery = analytics.data().ga()
 .get("ga:" + profileId,
 "2013-03-08",
 "2014-03-09",
 "ga:visits")
 .setDimensions("ga:campaign,ga:keyword,ga:date")
 .setSort("ga:campaign,ga:keyword")
 .setFilters("ga:medium==cpc")
 .setMaxResults(1000);

Query2:

Get apiQuery = analytics.data().ga()
 .get("ga:" + profileId,
 "2013-03-08",
 "2014-03-09",
 "ga:visits")
 .setDimensions("ga:campaign,ga:keyword,ga:date,ga:hour")
 .setSort("ga:campaign,ga:keyword")
 .setFilters("ga:medium==cpc")
 .setMaxResults(1000);

The only difference is the extra hour dimension.

The first query returns 651322 results The second query returns 91592 results

This doesn't make sense to me - I would expect approx 651322*24 = 15M results to be returned.

Does anyone know why this would be?

Thanks for any help,

Josh

1条回答
别忘想泡老子
2楼-- · 2019-08-01 05:36

It sounds to me like your data has been sampled.

samplingLevel string no The desired sampling level. Allowed Values:

 •DEFAULT — Returns response with a sample size that balances speed and accuracy.  
 •FASTER — Returns a fast response with a smaller sample size. 
 •HIGHER_PRECISION — Returns a more accurate response using a large sample size, but this may result in the response being slower.

Note: If I remember right the API should return some variable with your data. It tells you that the data was sampled: try looking for something like containsSampledData, sampleSize, or sampleSpace. I cant remember which one it is right this minute.

查看更多
登录 后发表回答