I'm using the below code.
{ reportRequests: [
{
viewId: 'XXXXXXXX',
dateRanges:[
{
startDate:'2018-01-01',
endDate:'2018-01-31'
}
],
metrics: [
{
expression: 'ga:users'
}
]
}
]}
I'm getting the response with total values. I need to get the data broken down date wise. I tried adding dimensions date, But I'm getting an error. What is the right way to get datewise data?
You will need to add the date dimension to your request in order to get your results with the dates.
{
"reportRequests":[
{
"viewId":"XXXX",
"dateRanges":[
{
"startDate":"2018-01-01",
"endDate":"2018-01-31"
}],
"metrics":[
{
"expression":"ga:users"
}],
"dimensions": [
{
"name":"ga:date"
}]
}]
}