Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

Report Suit

Avatar

Level 2

Hi Team , 

 

 I wanted to fetch day wise and market channel wise data from using report suit Jason in Azure. I am not able to fetch together from one Jason file.if I use date date range day as dimensions , in response I am getting aggregate data of all channel day wise and not showing channel name also .So I need to fetch each  market channel data day wise from json response 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

For each row returned by the API, you will have the Date, and data for each column:

 

"rows": [
        {
            "itemId": "1234567",
            "value": "Dec 1, 2023",
            "data": [
                23455,
                3435,
                7568,
                68678,
                5675,
                567,
                765
            ]
        },
....

 

 

The Date is obvious (Dec 1st, 2023 in this example), and each data in the array corresponds to each column... 

 

In my example, I have 7 columns, 7 data values are returned... in the order of the columns.. So if your column 1 is "Organic Search", then you know that 23455 belongs to that channel, and column 2 "Page Search" corresponds to 3435, etc....

 

The columns/data will always be returned in the order specified by your request columns.

View solution in original post

17 Replies

Avatar

Community Advisor

Firstly, it's "JSON", not "Jason". "JSON" is the abbreviation for JavaScript Object Notation, whereas "Jason" is the name of a person. Both are pronounced "Jason", though.

This guide might help you with constructing your Reporting API request: https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/reports/breakdowns/#second-leve... In your case, your 2nd level breakdown would be "Marketing Channel", rather than "Page". See if that helps.

Avatar

Level 2

Hi 

thanks for your suggestion It may be helpful for to fetch for particular one day from JSON. But  I need to fetch history of data ( more than year) so can’t check and change itemid manually for each day of data. I want to fetch all data in a single response from JSON as an each market channel data day level .

 

ex                                              C.          C2

market channe  day   

A.                     2020-10-1.         26.         46

b.                     2020-10-1.        636.     6363

 

c.                   2020-10-1.         544.        666

 

A.                   2020-10-2.       655       677

 

b                     2020-10-2.         66.       667

 

c.                      2020-10-2        355.   677

 

Avatar

Community Advisor and Adobe Champion

Will this be an ongoing date pull on a schedule or a one-time pull? Have you considered using Data Warehouse to pull this data into a CSV file that you can process? Even Data Warehouse can be scheduled, so depending on your needs, that still may be easier than the API...

 

 

However, using the method I mentioned below, I can pull data in that format in a single API call:

 

I've hidden my totals for my screenshot, and just pulled in a sample of my marketing channels (you would pull in all of yours as columns, and which ever metric you need, you may want Visit, or you may want Page Views or Marketing Channel Instance, etc)

Jennifer_Dungan_0-1702748988876.png

 

This is the JSON formatted API request that pulled the Workspace Report above, and what provided to me by using the debugger (you can put in the correcy suite, change the date range, change the Marketing Channels and Orders based on your needs, and probably drop the who "project association thing" as that is specific to Workspace):

{
    "rsid": "SUITEIDHERE",
    "globalFilters": [
        {
            "type": "dateRange",
            "dateRange": "2021-01-01T00:00:00.000/2023-12-01T00:00:00.000"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "1",
                "id": "metrics/visits",
                "filters": [
                    "0"
                ]
            },
            {
                "columnId": "2",
                "id": "metrics/visits",
                "filters": [
                    "1"
                ]
            },
            {
                "columnId": "3",
                "id": "metrics/visits",
                "filters": [
                    "2"
                ]
            },
            {
                "columnId": "4",
                "id": "metrics/visits",
                "filters": [
                    "3"
                ]
            },
            {
                "columnId": "5",
                "id": "metrics/visits",
                "filters": [
                    "4"
                ]
            },
            {
                "columnId": "6",
                "id": "metrics/visits",
                "filters": [
                    "5"
                ]
            },
            {
                "columnId": "7",
                "id": "metrics/visits",
                "filters": [
                    "6"
                ]
            }
        ],
        "metricFilters": [
            {
                "id": "0",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "2"
            },
            {
                "id": "1",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "1"
            },
            {
                "id": "2",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "7"
            },
            {
                "id": "3",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "9"
            },
            {
                "id": "4",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "3"
            },
            {
                "id": "5",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "10"
            },
            {
                "id": "6",
                "type": "breakdown",
                "dimension": "variables/marketingchannel",
                "itemId": "5"
            }
        ]
    },
    "dimension": "variables/daterangeday",
    "settings": {
        "countRepeatInstances": true,
        "includeAnnotations": true,
        "limit": 400,
        "page": 0,
        "dimensionSort": "asc",
        "nonesBehavior": "return-nones"
    },
    "statistics": {
        "functions": [
            "col-max",
            "col-min"
        ]
    },
    "capacityMetadata": {
        "associations": [
            {
                "name": "applicationName",
                "value": "Analysis Workspace UI"
            },
            {
                "name": "projectId",
                "value": "undefined"
            },
            {
                "name": "projectName",
                "value": "New project"
            },
            {
                "name": "panelName",
                "value": "Freeform table"
            }
        ]
    }
}

 

Avatar

Level 2

Hi , 

 

Thank you for information.I just want to know little bit more from you.How to get ItemId which you mentioned in metric filter?. Can we able to see market  channel name and date on output response of JSON. Because I tried some output response , either we get ‘value’ as date details on output or market channel details so can we get both details on output, so we can easily understand which data belongs which channel and on which date.

Avatar

Community Advisor and Adobe Champion

Look at my instructions below... I didn't write this, I used the Adobe generated API call here..

 

However, when it comes to Marketing Channels, they all have a specific numeric ID which the above map to:

 

Marketing Channel Manager:
(Admin > Report Suites (choose suite) Edit Settings > Marketing Channels > Marketing Channel Manager)

Jennifer_Dungan_0-1702871382249.png

 

 

You can see in the Workspace screenshot above, I had "Organic Search" as my first column, in the Marketing Channel Manager you can see Organic Search is "2", and the first item in the JSON formatted API Request is

 

{
  "id": "0",
  "type": "breakdown",
  "dimension": "variables/marketingchannel",
  "itemId": "2"
},

 

itemId "2" corresponds to the Channel ID "2"..

 

Not everything will always be numerically identified, but in this case, it is...

 

We don't use the APIs much right now, but if we did, using the built-in debugger is where I would go first, to save myself a lot of time... let it build the basics, then try to understand what it's doing, then make modifications if needed.

Avatar

Level 2

Hi ,

 

Thank you for explanation, I understood. I need one more information about JSON output, when we fetch data using using JSON, we get response, in that response, in rows arrays, in “value” variable either its mention date

 or market channel name (if we use market channel breakdown). So can we get both date and channel name in output response then we can easily find out , data is belongs to  which market channel and on which date.

Avatar

Correct answer by
Community Advisor and Adobe Champion

For each row returned by the API, you will have the Date, and data for each column:

 

"rows": [
        {
            "itemId": "1234567",
            "value": "Dec 1, 2023",
            "data": [
                23455,
                3435,
                7568,
                68678,
                5675,
                567,
                765
            ]
        },
....

 

 

The Date is obvious (Dec 1st, 2023 in this example), and each data in the array corresponds to each column... 

 

In my example, I have 7 columns, 7 data values are returned... in the order of the columns.. So if your column 1 is "Organic Search", then you know that 23455 belongs to that channel, and column 2 "Page Search" corresponds to 3435, etc....

 

The columns/data will always be returned in the order specified by your request columns.

Avatar

Level 2

Hi, 

 

How to fetch data segment level.I want to fetch each segment data using report suit api

Avatar

Community Advisor and Adobe Champion

Do you mean you have segments in Workspace that you want to apply and pull back data based on those segments?

 

Again, if you build those into your Freeform tables and use the debugger to get the API call, they should be built in...

 

I used to use API 1.3 and 1.4, back then, the segments were passed using the Segment Id (not name), I would be highly surprised if that wasn't the case in API 2.0 since it ensures the correct segment is used (if there are multiple segments with the same name).

Avatar

Level 2

Yes , segment level data available in Freeform table, I want to fetch those segment level data

Avatar

Community Advisor and Adobe Champion

You can have segments at the panel level. You can also stack Segments right into your tables...

Jennifer_Dungan_1-1704998013053.png

 

 

You can even have them in your breakdowns, as well as stack over one or more columns:

Jennifer_Dungan_0-1704997480423.png

 

 

 

Everything in workspaces is driven by APIs... so if you can build it, the API can be replicated.

Avatar

Level 2

Thank you for information.Can you give any example JSON of reports suit which used to fetch segments level data.Any parameters can we use in Dimension which help to fetch segments level data like daterangeday use for fetch day level data

Avatar

Community Advisor and Adobe Champion

You're report and segments will be unique to you... you can get the exact API call through the debug mode (see my instrunctions posted on 12/15/23 6:07:57 AM)... I am not sure what providing a sample JSON will achieve?

Avatar

Level 2

I have Jason but it’s not able to fetch each segment level data.If I get sample JSON I will modify my JSON based on that 

Avatar

Community Advisor and Adobe Champion

You seem to be missing what I am saying... if you use the Debugger to get the JSON for your report, you won't need to edit anything... the segments references will be a part of the JSON that you can copy and paste.

 

I didn't write the code above, I did not write the code I am about to paste... I built a workspace and used the JSON that Adobe gives me

 

{
    "rsid": "suitenamehere",
    "globalFilters": [
        {
            "type": "dateRange",
            "dateRange": "2024-01-01T00:00:00.000/2024-02-01T00:00:00.000",
            "dateRangeId": "thisMonth"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "0",
                "id": "metrics/event1"
            },
            {
                "columnId": "2",
                "id": "metrics/event1",
                "sort": "desc",
                "filters": [
                    "0"
                ]
            },
            {
                "columnId": "3",
                "id": "metrics/event1",
                "filters": [
                    "1"
                ]
            }
        ],
        "metricFilters": [
            {
                "id": "0",
                "type": "segment",
                "segmentId": "segmentid1"
            },
            {
                "id": "1",
                "type": "segment",
                "segmentId": "segmentid2"
            }
        ]
    },
    "dimension": "variables/prop1",
    "settings": {
        "countRepeatInstances": true,
        "includeAnnotations": true,
        "limit": 50,
        "page": 0,
        "nonesBehavior": "exclude-nones"
    },
    "statistics": {
        "functions": [
            "col-max",
            "col-min"
        ]
    },
    "capacityMetadata": {
        "associations": [
            {
                "name": "applicationName",
                "value": "Analysis Workspace UI"
            },
            {
                "name": "projectId",
                "value": "undefined"
            },
            {
                "name": "projectName",
                "value": "New project"
            },
            {
                "name": "panelName",
                "value": "Freeform table"
            }
        ]
    }
}

 

 

The columns that have a segment stacked on them have a filter reference, then there is a section for filters that include the segment reference... 

 

But again, you don't need to write this, or modify your code to include it... use the debugger as shown below and it will do ALL of this for you.

Avatar

Community Advisor and Adobe Champion

In addition to the above documentation, here is a little known trick for building out API calls:

 

Workspace Reports are all built using the API, and you can get all the calls that are used to make your tables of data. 

 

You first have to enable the debugger:

Jennifer_Dungan_0-1702648509775.png

 

This will add a new icon onto your tables:

Jennifer_Dungan_1-1702648536502.png

 

When you click on this, it will first ask you if you want to get the calls for the Freeform Table or for the Sparkline (choose the Table)

Jennifer_Dungan_2-1702648584955.png

 

Next, it will show you different timestamps, some complex tables may need multiple calls, you can check each of these, and when you choose them, it will take you to a new screen that will show you the API requests in different languages (you can take the one relevant to you and use it as is, or modify it to suite you better.

Jennifer_Dungan_3-1702648963748.png

 

 

Basically, if you can build a basic freeform table that returns the data you need in Workspaces, you can use those same calls to get the same data into your external data pulls.

 

Good luck.

Avatar

Level 2

I tried JSON which given by debugger but in output response I am getting only visits data but not getting segments name level.I want to see segments name and visit data in output response.For your information Dimension parameter is missing in JSON which is given by debugger