I am trying to pull reports from Data Warehouse that use multiple breakdown dimensions, including segments, but am not able to add segments as a dimension. Found this old thread suggesting it is not supported in Adobe Analytics 1.4 API, is that still the case?
If it is still the case, how could I use Adobe Analytics 2.0 API to get the same reports with multiple breakdowns including segments as a dimension?
Views
Replies
Total Likes
Hi @dataen , i think the https://experienceleaguecommunities.adobe.com/t5/adobe-analytics/ct-p/adobe-analytics-community forum would be a better spot for this question as that's where the Analytics experts hang out!
hi @dataen
Yes you are correct, the Adobe Analytics 1.4 API does not support segments as breakdowns. But the Adobe Analytics 2.0 API offers this support. Adobe Analytics 2.0 API uses JSON-based POST requests, which allows for more advanced and flexible reporting queries an you need the right permissions for the API.
Here is a basic example that you can try but I think you need to change based on your situation or environment:
// Import the required packages
var axios = require('axios');
var querystring = require('querystring');
// Set up the request headers
var headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer {Your_access_token}", //Replace {Your_access_token} with your actual access token
"x-api-key": "{Your_API_Key}", //Replace {Your_API_Key} with your actual API Key
"x-proxy-global-company-id": "{Your_Company_ID}" //Replace {Your_Company_ID} with your actual Company ID
};
// Create the request body
var data = {
"rsid": "{Your_Report_Suite_ID}", //Replace {Your_Report_Suite_ID} with your actual Report Suite ID
"globalFilters": [
{
"type": "segment",
"segmentId": "{Your_Segment_ID}" //Replace {Your_Segment_ID} with your actual Segment ID
}
],
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/visits"
},
{
"columnId": "1",
"id": "metrics/pageviews"
}
]
},
"dimension": "variables/evar1",
"settings": {
"dimensionSort": "desc",
"limit": "100"
}
};
// Send the request
axios.post('https://analytics.adobe.io/api/{Your_Company_ID}/reports', data, { headers: headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Hope this answers your question.
Thanks
Madhan
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies