aalan

How to Extract data from Adobe Analytics using Python

Adobe Analytics data – Reports API v2.0 & Python

Adobe Analytics v2.0 API offers quite a lot of functionality. Adobe has made huge steps over the last few years in documenting and rebuilding its APIs. The majority of the information can be found at https://github.com/AdobeDocs/analytics-2.0-apis. One of the most useful ones is the Reports API for downloading analytics reports data. This can be utilized in automated Python (or other programming languages) data pipelines and/or ad-hoc analysis in setups outside of Analysis Workspace.

However, the API exposed currently is not – for lack of a better word – very well structured and programming-friendly. The major drawback is that it was built with the intent of serving Analysis Workspace. This means that it requires a specific JSON data structure that defines the report to be requested (sample).

Depending on the number of dimensions added to the report, this can get very complicated very quickly. In order to get around that, I have created a Python package that allows to better manage multiple dimensions without the added burden of worrying about multiple breakdowns.

Python package overview

The package offers some basic high level wrappers and abstracts the complexity of “how to make data requests for multiple breakdowns”.

It relies on using a service account with developer access. To install the latest version using pip (either from PyPi or GitHub)

  • PyPi: pip install analytics-mayhem-adobe
  • Github: pip install git+https://github.com/konosp/adobe-analytics-reports-api-v2.0

Results

Related Posts

Leave a comment

You must login to add a new comment.

[wpqa_login]

2 Comments

  1. Hey,
    I am working on a project that requires me to capture granular data from Adobe Workspace. I have been referring this article to do the same: https://www.ourpcgeek.com/how-to-extract-data-from-adobe-analytics-using-python/ When I tried using the get_report_multiple_breakdowns() function from analytics.mayhem.adobe library, I was only able to capture granular data which is present in one page. I have used set_limit(rows_limit) function to increase the limit of rows I can capture, but that didn't pan out.
    Is there another way which can help me capture data present across all the pages in adobe workspace? Attaching piece of code which I had tried out : from analytics.mayhem.adobe import analytics_client aa = analytics_client( adobe_org_id = ADOBE_ORG_ID, subject_account = SUBJECT_ACCOUNT, client_id = CLIENT_ID, client_secret = CLIENT_SECRET, account_id = ACCOUNT_ID, private_key_location = PRIVATE_KEY_LOCATION ) aa.add_metric(metric_name= 'metrics/visits') aa.add_metric(metric_name= 'metrics/orders') aa.add_metric(metric_name= 'metrics/revenue') aa.add_dimension(dimension_name = 'variables/campaign.32') aa.add_dimension(dimension_name = 'variables/campaign.33') aa.add_dimension(dimension_name = 'variables/campaign.35') aa.add_dimension(dimension_name = 'variables/campaign.38') aa.set_limit(100) data = aa.get_report_multiple_breakdowns()