I have a custom report in Google Analytics Dashboard. I also get this data through python googleapiclient. But the data between the dashboard and this doesn't match. There is consistently a difference of ~10% less in data points obtained through python.
Here's the format of report object.
def get_report(analytics, token):
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '1daysAgo', 'endDate': '1daysAgo'}],
'metrics': [
{'expression': 'ga:users'},
........
],
'dimensions': [
{'name': 'ga:date'},
{'name': 'ga:hour'},
....
],
'pageSize': 100000,
'pageToken': token,
'samplingLevel': 'HIGH',
}]
}
).execute()
I believe sampling is not the problem since report.get('samplesReadCounts') returns None.
What could be the problem? Checked in query-explorer .Also not matching.