Analytics API | Community
Skip to main content
Level 2
July 3, 2018
Solved

Analytics API

  • July 3, 2018
  • 14 replies
  • 18416 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

Alexis_Cazes_
Level 10
September 19, 2018
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.

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

raviprasadp7863
Level 2
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 ?