I'm seeing a fairly large discrepancy between metrics within the UI compared to the same metrics pulled through the API. I'm using the entire month of February (2/1/2015 - 2/28/2015) as the sample date range.
UIWhen I run the Acquisition > Overview report I see 2,178,271 Sessions from Organic Search and 1.82 Pages / Session. There is no notice at the top specifying the sample rate.
I then created a Custom Report where I used Pageviews, Sessions, Users as the Metrics and Default Channel Grouping as the Dimension. That report generated 2,176,189 Sessions and 3,584,655 Pageviews, which equals 1.65 Pageviews/Session. The notice at the top of the report says, "
This report is based on 220,723 sessions (4.91% of sessions)." That equates to 4.5M sessions (220,723 / 0.0491).
APIHere's how I setup the same report through the UI:
- metrics = "ga:pageviews,ga:sessions,ga:users"
- dimensions = "ga:channelGrouping"
- samplingLevel = "HIGHER_PRECISION"
- start_date = "2011-01-01"
- end_date = "2015-02-28"
- data = service.data().ga().get(
ids=ids,
start_date=month[0],
end_date=month[1],
metrics=metrics,
dimensions=dimensions,
samplingLevel=samplingLevel
).execute()
Looking at the Organic Search row I see we have 2,598,126 Sessions and 4,828,035 Pageviews, which equals 1.86 Pageviews/Session.
The sample size (data['sampleSpace']) returned is 6,877,979. Are those PVs, Sessions, or Users?
The total results (data['totalForAllResults']) are:
- 'ga:pageviews': '14,723,822'
- 'ga:sessions': '6,877,980'
- 'ga:users': '5,138,654'
The sample size appears to be much larger when querying through the API, however, the numbers don't match up to what I'm seeing through the UI. Which method should I rely on for accurate metrics? Is the report I'm generating through the API the same as the report I created through UI?
Thanks for any insight!