Expand my Community achievements bar.

SOLVED

Breakdown dimensions with multiple ItemIDs on Report API

Avatar

Level 1

I've been facing a performance issue when dealing with multiple dimensions (more than 2) on Reports API using Python (URI: analytics.adobe.io/api/xxxx/reports). I didn't find any example of this case, not even a topic in this community.

When I need to get all data for multiple dimensions, firstly I need to create all combinations (like a matrix) of each ItemID from a dimension "A" with each ItemID from a dimension "B" and "C" and so on. it causes a ton of combinations and a ton of API requests, and the majority of all requests doesn't brings back any result because, for example, not all "days" had the same "product" sold.

 

So, I wonder if someone knows a way to use multiple metricFilters for the same dimension in an unique API request.

Example:

 

{
    ...
    "metricContainer": {
        "metrics": [
            {
                "id": "metrics/orders",
                "filters": [ 0 ]
            }
        ],
        "metricFilters": [
            {
                "id": "0",
                "type": "breakdown",
                "dimension": "variables/product",
                "itemId": ["0000000001", "0000000002", "0000000003"]
            }
        ]
    },
    "dimension": "variables/campaign",
    ...
}
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I haven't used the API 2.0 much, but my understanding was that to "improve" performance, it didn't do complex breakdowns... hence the need to run multiple requests....

 

However, if you are trying to get a lot of breakdowns, it's not all that efficient... while not really recommended for new implementations, have you considered using the old API 1.4?

 

This API would allow you to do breakdowns in a single call... the behaviour is a bit different....

 

Essentially, you have to follow these steps:

  1. Create a Report using Report.Queue - you would get back an id
  2. Next, you had to keep checking the Report.Queue for your Report ID to be completed (this is where the process was a slow, the report wasn't done immediately, you need to keep checking until it's done)
  3. Once done, you can now get your Report using Report.Get

 

However, you can basically get dynamic breakdowns of your dimensions...

 

{
	"reportDescription": {
		"reportSuiteID": "[suitename]",
		"dateFrom": "2024-01-01",
		"dateTo": "2024-01-18",
		"metrics": [{
			"id": "orders"
		}],
		"elements": [{
					"id":"products",
					"selected": ["product1","product2","product3"]
                },{
					"id": "eVar1"
		        },{
			        "id": "eVar2",
			        "top": "50"
		}]
	}
}

 

This should bring back the top 50 eVar2 values, under each eVar1 value, under each of the three selected product values (product1, product2 and product3) (if I remember my syntax correctly)

 

You don't have to use "selected" or "top X" logic, but I thought it might help get you started to see that syntax in use.

 

The above call would return something like 1234566778 immediately, then you would have to keep checking the queue for this ID.. when done, you can retrieve the completed report.

 

 

https://developer.adobe.com/analytics-apis/docs/1.4/guides/reporting/methods/

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

I haven't used the API 2.0 much, but my understanding was that to "improve" performance, it didn't do complex breakdowns... hence the need to run multiple requests....

 

However, if you are trying to get a lot of breakdowns, it's not all that efficient... while not really recommended for new implementations, have you considered using the old API 1.4?

 

This API would allow you to do breakdowns in a single call... the behaviour is a bit different....

 

Essentially, you have to follow these steps:

  1. Create a Report using Report.Queue - you would get back an id
  2. Next, you had to keep checking the Report.Queue for your Report ID to be completed (this is where the process was a slow, the report wasn't done immediately, you need to keep checking until it's done)
  3. Once done, you can now get your Report using Report.Get

 

However, you can basically get dynamic breakdowns of your dimensions...

 

{
	"reportDescription": {
		"reportSuiteID": "[suitename]",
		"dateFrom": "2024-01-01",
		"dateTo": "2024-01-18",
		"metrics": [{
			"id": "orders"
		}],
		"elements": [{
					"id":"products",
					"selected": ["product1","product2","product3"]
                },{
					"id": "eVar1"
		        },{
			        "id": "eVar2",
			        "top": "50"
		}]
	}
}

 

This should bring back the top 50 eVar2 values, under each eVar1 value, under each of the three selected product values (product1, product2 and product3) (if I remember my syntax correctly)

 

You don't have to use "selected" or "top X" logic, but I thought it might help get you started to see that syntax in use.

 

The above call would return something like 1234566778 immediately, then you would have to keep checking the queue for this ID.. when done, you can retrieve the completed report.

 

 

https://developer.adobe.com/analytics-apis/docs/1.4/guides/reporting/methods/

Avatar

Community Advisor

The Reporting API is not designed to get "ALL" data. It is the same API being used by AA Workspace and is designed to get a small chunk of data iteratively and interactively.

If you really need to get ALL data using API, there will be lots of data expansions and iterations to get all combinations as you want. It can be a very slow and ineffective process.

The more effective and efficient approach to getting a large amount of data is using the Data Warehouse or Data Feed. Data Warehouse is an experience closer to the Workspace and you can use segments in creating the request. Data Feed is the ultimate raw hit level data you can have but will require a deeper knowledge to calculate certain metrics and build segments from scratch if required.