In the previous post (Adobe Analytics data – Reports API v2.0 & Python), provided an overview of a Python package to download Adobe Analytics Reports data using the API version 2.0. However one limitation at the time was no support for OAuth authentication. This update introduces the necessary functionality to complete the authentication process using OAuth. Heads up: The below process has been tested only in Jupyter Notebook!
Create the Adobe I/O Integration
First, you need to have System Admin access or Developer permissions. Next, you will create an integration within the Adobe I/O Console. Given that Adobe changes UI and/or documentation every 3 months, its easy for this post to become outdated! So I will just refer you to the GitHub documentation of creating an integration.
As of the writing of this post, this is how the integration looks like after its creation. You will need to use the Client ID and the Client Secret later on.
Configure the Adobe Analytics client
The analytics client, has a similar initialisation as on the JWT method. This time we need the Client ID and the Client Secret obtained during the creation of the integration. Furthermore we need the Global Company ID which you need to connect to. The most useful instructions I have found on how to obtain it are at https://youtu.be/lrg1MuVi0Fo?t=96.
aa = analytics_client(
auth_client_id = client_id,
client_secret = client_secret,
account_id = global_company_id
Next step is to invoke the authentication process.
As soon as this is called, an input prompt will appear. The browser will open another window asking you to login Adobe Experience Cloud.
You will need to complete the authentication. During the integration creation, you set “www.adobe.com” as the redirect URI. An authentication code will be appended to the redirect URI (?code=eyJ..). Copy the full URL and past it into the prompt box within the notebook.
Downloading the data
Next step is to complete the report configuration (same process as in the previous post).
Full example can be found at this notebook. In order to install the package run:
pip install adobe-analytics-mayhem
- Original post using JWT authentication: https://analyticsmayhem.com/adobe-analytics/reports-v2-api-python/
- GitHub: https://github.com/konosp/adobe-analytics-reports-api-v2.0
- Jupyter Notebook example
- Adobe OAuth Authentication: https://github.com/AdobeDocs/analytics-2.0-apis/blob/master/oauth-curl.md