Adobe Analytics API 2.0

Analytics API 2.0 Wrapper Update

Hello, on this post I will explain the major update that happen on the wrapper for the Adobe Analytics API 2.0 that I have on my github.
This should be brief but it is better if I document it and here it is.

Why the update ?

The update happened because as a Consultant you may have to use different companies at the same time.
Also if you have different login companies, you may need to change the configuration from time to time when you are switching from one to another

Because of all of these reasons, I decided to switch the logic of the wrapper from being a single instance of the library to a class where you can multiple instances.

These instances are initiated with the globalCompanyId that you are retrieving. Therefore, if you have multiple login company, you can use the same connection to request the data from different login company at the same time, with different instances of that connection.

What has changed ?

Analytics class

From now on the different methods live in the Analytics class. You need instantiate that class with the globalCompanyId that you have selected.

As described above, you could have several companyId in your Organization. This functionality enables you to create API requests for different Login company / globalCompanyId at the same time.

You can set up the instance as follow :

import aanalytics2 as api2
api2.importConfigFile('myconfig.json')
cids = api2.getCompanyId()
cid = cids[0]['globalCompanyId'] ## using the first one
mycompany = api2.Analytics(cid)

Fix path finder

It is now possible to use relative path on the config file, for your key.
It used to be creating problem when you didn’t have the key at the same place than the location you run your script.

Now the module is able to navigate to different folder if require.
In the config file, you can now enter the following string and it will work :
“./my/sub/folder/myKey.key”

Documentation update

As this package became more and more “popular”. I created a proper documentation inside GitHub in order to demonstrate on how to use it.

To be more exact, on how to get started : https://github.com/pitchmuc/adobe_analytics_api_2.0/blob/master/docs/getting_started.md
I think that enough description for the methods have been written in the docstring.
In case you need more help, feel free to participate in the GitHub documentation through Pull request or issue. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *