I have a Google Analytics account where multiple companies have shared their website with me. Now trying to get visitors/sessions/hits data from those websites using the API. It works perfectly fine for 2 websites, but 4 others aren't returning any data. It's a consistent problem and it doesn't matter whether I select the past week, or a week in the past. I'm also not getting any error, or message, just a 0 for all 3 dimensions. This is the exact response I'm getting:
{
"reports": [
{
"data": {
"isDataGolden": true,
"totals": [
{
"values": [
"0",
"0",
"0"
]
}
]
},
"columnHeader": {
"dimensions": [
"ga:segment",
"ga:pagePath",
"ga:date"
],
"metricHeader": {
"metricHeaderEntries": [
{
"type": "INTEGER",
"name": "ga:users"
},
{
"type": "INTEGER",
"name": "ga:sessions"
},
{
"type": "INTEGER",
"name": "ga:hits"
}
]
}
}
}
]
}
Update: I selected a week 6 years back when the website got ~400 visitors a day, instead of the ~10k it is getting to day, and it does seem to work now. Is there a way to make it work with large number of visitors as well? I'm just using the analytics.reports().batchGet
function of the Python SDK.
The solution was using 'operator': 'PARTIAL'
instead of 'operator': 'EXACT'
.