Monthly Unique Visitors empty in API response
Hello,
I'm trying to extract daily and monthly unique visitors using the Analytics API, but the metrics are always returning 0 instead of the value seen in the Reports UI. The metric identifiers I'm using are metrics/visitorsmonthly and metrics/visitorsdaily.
An example JSON request:
{
"rsid": "***",
"globalFilters": [
{
"type": "dateRange",
"dateRange": "2019-09-16T00:00:00/2019-09-17T00:00:00"
}
],
"metricContainer": {
"metrics": [
{
"columnId": "pageviews",
"id": "metrics/pageviews"
},
{
"columnId": "videostart",
"id": "metrics/videostart"
},
{
"columnId": "timespentvisit",
"id": "metrics/timespentvisit"
},
{
"columnId": "visitorsmonthly",
"id": "metrics/visitorsmonthly"
},
{
"columnId": "visitorsdaily",
"id": "metrics/visitorsdaily"
}
]
},
"dimension": "variables/daterangeday",
"settings": {
"countRepeatInstances": true,
"limit": 50,
"page": 0,
"dimensionSort": "asc"
},
"statistics": {
"functions": [
"col-max",
"col-min"
]
}
}
And the response:
{
"totalPages": 1,
"firstPage": true,
"lastPage": true,
"numberOfElements": 1,
"number": 0,
"totalElements": 1,
"columns": {
"dimension": {
"id": "variables/daterangeday",
"type": "time"
},
"columnIds": [
"pageviews",
"videostart",
"timespentvisit",
"visitorsmonthly",
"visitorsdaily"
]
},
"rows": [
{
"itemId": "1190816",
"value": "Sep 16, 2019",
"data": [
652710,
685738,
611.7979478807963,
0,
0
]
}
],
"summaryData": {
"nonesFilteredTotals": [
652710,
685738,
611.7979478807963,
0,
0
],
"totals": [
652710,
685738,
611.7979478807963,
0,
0
],
"col-max": [
652710,
685738,
611.7979478807963,
0,
0
],
"col-min": [
652710,
685738,
611.7979478807963,
0,
0
]
}
}
Has anyone successfully used these metrics in the Analytics API? Am I missing a requirement for using them?
Thanks!
