Real time API and reporting granularity - alcazes/Adobe-Analytics-from-A-To-Z GitHub Wiki
When you run a real-time API you might need to extract the real-time data for the past X minutes only displayed by blocks of X minutes.
Realtime reports support Relative dates
To do so you need to use the following:
- "dateGranularity":"minute:1"
- In this example we say that we want to report the data by 1 minute interval.
- "dateFrom": "-5 minute"
- In this example we say that we want the reporting period to start 5 minutes ago
- "dateTo": "now"
- In this example we say we want the reporting period to end right now.
Lets say that I set up a real-time report in Adobe Analytics using elements page and site section and I want to report for the past 5 minutes by interval of 1 minutes all data from site section Iphone for classification of page testClassification then it will look as follow
{
"reportDescription": {
"reportSuiteID": "[MY REPORT SUITE ID]",
"dateGranularity": "minute:5",
"dateFrom": "-5 minute",
"dateTo": "now",
"metrics": [{
"id": "pageviews"
}],
"elements": [{
"id": "sitesection",
"search": {
"type": "AND",
"keywords": [
"iphone"
]
}
},{
"id": "page",
"classification": "testClassification",
"search": {
"type": "NOT",
"keywords": [
"unspecified"
]
}
}
],
"source": "realtime"
}
}