Analytics API | Community
Skip to main content
New Participant
July 3, 2018
Solved

Analytics API

  • July 3, 2018
  • 14 replies
  • 18396 views

Hi whoever knows the answers,

I have several questions... after going through the analytics api 1.4 documentation, i realized it doesn't help answer any of the following:

1.) how do i build multi-segment api requests

-i.e. device type = mobile, not tablet, some other condition - without creating a new segment in the dashboard

2.) how do i build multi-metric api requests

-i.e. the documentation says metric[ {id: value} ]... cool but why does the following work

"metrics":[{

"id":"uniquevisitors",

"element":"evar13",

"selected":[

"/some-website-page.html"

]}]

my point is, how do i add queries like this and what are all the properties and argument types

3.) how do i build multi-dimension api requests

-i.e a target activity (let's say experience) that has a page with two or three variants, how do i correctly built that type of request and what are all the properties and settings that i can use

4.) why do the numbers in the api not match the gui in analytics, let's say for visitors or unique visitors, how do i add the property that says don't count repeat visitors or whatever it is you do in the gui. what are all the properties a report description can contain.

5.) for god sakes, why did you deprecate the target api inside the analytics api, if someone only has access to the target api, how do you query a list of campaigns or maybe just ab tests or whatever, and how do you do it without using the data warehouse to get a zillion urls that need to be mapped one by one.

there's a lot more questions but i don't want to type them if no one knows the answer. its obviously possible since the workspace dashboard can do it and i've gone through the ajax requests it makes but the naming conventions, structure of the data and format don't match. maybe someone at adobe can help with these extremely frustrating questions.

thanks,

isaac

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Alexis_Cazes_

Hi Isaac,

I am going to answer some questions and hopefully it will help you.

First to see what the request should look like with all of the options either use the api explorer (you do not need to input username and password to see default structure, simply select api Report and Method Queue ) or you could use swagger (Notice in Example Value you should see full structure of request). Right so not all fields are required to do a request and I will try to give example a bit later on.

How do i build multi-segment api requests

Ok so I think one of the solution would be to use inline segmentation

Another solution would be to apply filtering in the elements themselves:

Check reportDescriptionElement and reportDescriptionSearchType

(notice the element searches: this will allow you to create multiple searches, so first level would be type and and inside searches the different ones like not).

How do I build multi-metric api requests

You will need to specify different metric ids. (I do not know why you example works)

{

   "reportDescription":{

      "reportSuiteID":"reportSuiteId",

      "dateFrom":"YYYY-MM-DD",

      "dateTo":"YYYY-MM-DD",

      "metrics":[

         {

            "id":"uniquevisitors"

         },

         {

            "id":"event27"

         },

         {

            "id":"event28"

         },

         {

            "id":"event29"

         },

         {

            "id":"event30"

         },

         {

            "id":"event31"

         },

         {

            "id":"event32"

         },

         {

            "id":"cm2566_5adf02ff7245ec54ba3e7317"

         },

         {

            "id":"cm2566_5adf01f90d38c21db0b2ba88"

         },

         {

            "id":"cm2566_5adf037102f60c51b92c5d5f"

         },

         {

            "id":"cm2566_5adf03a57a877de82a990a97"

         },

         {

            "id":"cm2566_5adf04051d84534d9a98e6d9"

         },

         {

            "id":"cm2566_5adf0424366e5b4688b4c62d"

         },

         {

            "id":"cm2566_5adf046155bf155cfbf0af5e"

         },

         {

            "id":"cm2566_5a4ba8b31d84536d599b3a99"

         }

      ],

      "segments":[

         {

            "id":"s2566_598b2c8b0d38c26a449bf986"

         },

         {

            "id":"s2566_59c37616dd0ab15248d5a6bd"

         },

         {

            "id":"s2566_59c4dfa9de89edf2ca867650"

         },

         {

            "id":"s2566_597b01f70d38c20a175cd5d0"

         }

      ],

      "currentData":"true",

      "elementDataEncoding":"utf8"

   }

}

Notice that in the request above I specified default metrics (eventx) but also calculated metrics (cmXXXXX).

You will also notice that I used stacking segments as well.

How do i build multi-dimension api requests

I did not work with target data much so I won't be able to provide any insight target wise.

Having said that I think if you want to extract data where a dimension can be X or Y or Z then use one this solution:

- Segments: create either one segment with OR condition or multiple segments that you can stack up as above.

- Use elements filtering to filter only for value X, Y, Z

- Use inline segmentation as above.

If you want to get more than one dimension in the report then you will need to define more than one element.

{

   "reportDescription":{

      "reportSuiteID":"rsid",

      "dateFrom":"YYYY-MM-DD",

      "dateTo":"YYYY-MM-DD",

      "metrics":[

         {

            "id":"uniquevisitors"

         },

         {

            "id":"event27"

         },

         {

            "id":"event28"

         },

         {

            "id":"event29"

         },

         {

            "id":"event30"

         },

         {

            "id":"event31"

         },

         {

            "id":"event32"

         },

         {

            "id":"cm2566_5adf02ff7245ec54ba3e7317"

         },

         {

            "id":"cm2566_5adf01f90d38c21db0b2ba88"

         },

         {

            "id":"cm2566_5adf037102f60c51b92c5d5f"

         },

         {

            "id":"cm2566_5adf03a57a877de82a990a97"

         },

         {

            "id":"cm2566_5adf04051d84534d9a98e6d9"

         },

         {

            "id":"cm2566_5adf0424366e5b4688b4c62d"

         },

         {

            "id":"cm2566_5adf046155bf155cfbf0af5e"

         }

      ],

      "elements":[

         {

            "id":"evar9",

            "top":"200",

            "search":{

               "type":"not",

               "keywords":"FILTER1"

            }

         },

         {

            "id":"evar37",

            "top":"200",

            "search":{

               "type":"or",

               "keywords":"FILTER2"

            }

         },

         {

            "id":"evar7",

            "top":"200"

         }

      ],

      "segments":[

         {

            "id":"s2566_598b2c8b0d38c26a449bf986"

         },

         {

            "id":"s2566_59c37616dd0ab15248d5a6bd"

         },

         {

            "id":"s2566_59c4dfa9de89edf2ca867650"

         },

         {

            "id":"s2566_597b01f70d38c20a175cd5d0"

         }

      ],

      "currentData":"true",

      "expedite":true,

      "elementDataEncoding":"utf8"

   }

}

One more thing, there is an API to create segments as well on fly, so you could always use this API before calling the Reporting API to do dynamic segmentation. I have a project internally when we run a ruby script to update a set of segments before the analysis workspace scheduled report run each week which allows us to not update the segments manually each week.

That is all from me.

Best regards.

Alexis Cazes

14 replies

raviprasadp7863
New Participant
August 29, 2019

Is there any solution for below error:

"error_description": "The maximum number of elements supported is 4"

It can be only 4 or can we add more somehow in the elements ?

New Participant
May 3, 2019

Hello,

I'm using for a long time now the API 1.4 with the python library provided in gitHub. We have a lot of automations in place running to create reports and extract data on a daily basis. I saw above that the API 1.4 will be obsolete quiet soon and I was wondering if you are going to publish a Python library for the API 2.0 so we can migrate to the API 2.0 before the 1.4 becomes obsolete.

Thanks in advance for your help.

Best,

Elisavet

New Participant
September 19, 2018

Thx. Did read that, but I think I found a solution for now. Previously our users entered their password and we could retrieve the web services secret using Company.GetLoginKey Since that no longer works for 'Cloud' users they will need to get the secret from the Adobe Analytics->Admin->User Management and enter that directly.

Alexis_Cazes_
New Participant
September 19, 2018
New Participant
September 13, 2018

Interesting and helpful thread.

I saw you comment

It is important to know that for now the Adobe Analytics Service account integration does not work while querying the Analytics API. The access_token will not be recognised as valid. It is due to some internal limitation

Is there a plan/target date for service accounts to work with the analytics api? We have been using 1.4 apis to integrate with Adobe on behalf of others. With the migration to cloud, we can no longer use Company.GetLoginKey to get an access key.

What is the recommended replacement?

Gigazelle
Employee
July 25, 2018

Just had a meeting yesterday with the API team

The 1.4 API will not be going away soon (at least a year, maybe more). The v2 API needs to be in solid shape before we even think about sunsetting 1.4.

The v2 API should be available around October, and as Alexis said, will be through Adobe I/O.

Alexis_Cazes_
New Participant
July 25, 2018

As far as I know Adobe Analytics API 1.4 has not been sunset yet so it is still valid. However this API cannot reproduce the Analysis Workspace reports in one request, it most likely will take more than one request to reproduce some the tables from Analysis Workspace.

The new Analytics API that I mentioned in the post above is the one used behind Analysis Workspace and the v2 version should be available soon as per I was told. This API will require to authenticate via Adobe I/O integration unlike Adobe Analytics API 1.4.

Maybe Gigazelle​ can provide more details on the future of the Adobe Analytics API 1.4 .

marion33678522
New Participant
July 25, 2018

Hello to all,

So if I understood well, all the old Api requests to the report Api will be obsolete ?

I started working in a way to automate data extraction using the API , and we started using a python library that helps us to connect to the API and extract all the metrics using segments IDs.

Cheers !

Alexis_Cazes_
New Participant
July 17, 2018

The solution that I am going to describe her is to use with curl commands. One thing to be aware of is as of now the v1 of the Analytics API for Analysis Workspace does not support a way to generate the access_token programatically, what I mean by that is that using the Adobe I/O integration you will always have the step to enter your username and password.

Using Adobe Analytics interface

Using the debugger to get request and access_token

  1. Go to Analysis Workspace and open the report that you want to reproduce via API.
  2. Open a the developer console in your browser and input
    adobe.tools.debug.includeOberonXml = true
  3. Reload the page and you should see an orange bug next to each table and visualisations
  4. Click on the orange bug
  5. Click on Freeform tables
  6. Select entry with the most up to date date
  7. A screen should be displayed with title Oberon request

What you are interested is in the JSON request. so copy it somewhere to reuse later.

You will also notice a CURL request section. You will notice the he curl request is build for you with the access token, the json request and which server to send the request to. I would advise you to set includeOberonXml to false.

The final request should look as follow (based on the report screenshot that I provided in previous post):

Using the developer console to get access_token

You can also get the access token while you are in Adobe Analytics doing the following:

  1. Open the developer console
  2. Input
    adobe.analytics.appConfig.appService.token
  3. The access token should be displayed.

Using Adobe I/O

Ideally you would want to use Adobe I/O to get the access token. You will need to create an Adobe Analytics integration using the Adobe I/O console.

1. Api Integration:

Adobe I/O Console

2. Authentication:

Authentication

It is important to know that for now the Adobe Analytics Service account integration does not work while querying the Analytics API. The access_token will not be recognised as valid. It is due to some internal limitation


1. Go to Adobe I/O Console  and create and Adobe Analytics Integration using OAuth integration.

2. During the configuration use this url as redirect: https://runtime.adobe.io/api/v1/web/io-solutions/adobe-oauth-playground/callback

3. Complete the integration

4. Now open the integration details and take note of API Key (Client ID) and Client secret.

5. Go to OAuth 2.0 Playground  and add the different details and click on generate token

6. You will be redirected to log in page enter you adobe ID details and you should finally be redirected to tokens tab

You can use the access_token in same curl request as above

Alexis_Cazes_
New Participant
July 16, 2018

I will try to get back to you tomorrow with more details. Working on using this API for quite some days now and having some issues to go around due to undocumented aspects.

What I figured out is that while it was show cased at the Summit some people said that the current API should not be customer facing ... However I talked internally at Adobe and they said that v2 of this API should be available "soon". To be honest I do not know what to expect in terms of timeframe wit just a "soon" answer. If I have to guess I would say that it might be available in next major releases like fall release maybe.

For the credentials I will provide more details tomorrow.