1

I am tracking a number of events on a website and am trying to extract some analytics data via the api. The problem I have found can be boiled down to this scenario. If I want to know how many unique events have happened per day, I can run a query such as:

?start-date=2016-02-19&end-date=2016-02-24&metrics=ga%3AuniqueEvents&dimensions=ga%3Adate

which will give me table of the number of unique events per day from Feb 19th to Feb 24th. In my specific example, I will have a row that say I had 12914 unique events on Feb 22nd.

If I now change the time period for the query to something like this:

?start-date=2016-02-01&end-date=2016-05-01&metrics=ga%3AuniqueEvents&dimensions=ga%3Adate

I will basically get the same table, only from Feb 1st to Mai 1st. Was suprises me though is, that now the column for Feb 22nd reads 12966 events, while my assumption would be, that this number should actually stay the same.

Is there something I'm missing here? In which scenario would these numbers make sense? Thanks for your help!

huesforalice
  • 2,263
  • 2
  • 21
  • 29
  • 1
    In your response what is the value of [containsSampledData](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#containsSampledData) for the two requests? [Sampling](https://support.google.com/analytics/answer/2637192) is the practice of selecting a subset of data from your traffic and reporting on the trends available in that sample set. You can specify the sampling level to use for a request by setting the [samplingLevel](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#samplingLevel) parameter. – Matt Apr 12 '16 at 17:30
  • Hey Matt, thanks for pointing me towards this. This indeed seems to be the problem and based on my research I can't really get around this in my specific use case. If you like you can answer this and I can accept it. – huesforalice Apr 13 '16 at 09:35
  • 1
    Answered below, thanks. If you have any follow up questions I'd be happy to help. – Matt Apr 13 '16 at 18:39

1 Answers1

1

Check the API response for the value of containsSampledData.

Sampling is the practice of selecting a subset of data from your traffic and reporting on the trends available in that sample set.

You can specify the sampling level to use for a request by setting the samplingLevel parameter to HIGHER_PRECISION.

You can also try simplifying your request by shortening the date range, or requesting fewer dimensions.

Matt
  • 4,507
  • 2
  • 23
  • 46