Solved

Unable to retrieve Campaign/Flow details for  ‘Placed Order’ metric event via API


Badge +2

Hi,

I am using Events API endpoint from https://developers.klaviyo.com/en/reference/get_events to fetch events data for our accounts. 

I don’t see Campaign/Flow details now for both ‘Placed Order’ and ‘Ordered Product’ metrics event via API

These used to be there in the response payload when I was using “v2023-02-22”. Not available in the latest version -  “v2024-02-15”

Can someone help me out here?

 

regards

Jayadheer

 

icon

Best answer by saulblum 6 May 2024, 18:56

View original

5 replies

Userlevel 5
Badge +7

Hi, I think you need to add an include param now:

https://a.klaviyo.com/api/events/?include=attributions

 

Userlevel 5
Badge +7

https://developers.klaviyo.com/en/docs/changelog_#revision-2024-02-15-ga

 

Breaking changes

 

Get Event(s) API

We have removed the $attribution field from event_properties starting with this revision. To include this data in your request, add ?include=attributions to your request URL.

 

Badge +2

Hi,

I tried with  ?include=attributions to request URL.

Got only like this in the response object:

'attributions': {'data': [{'type': 'attribution', 'id': '5bQg837Gmbn'}]}}

 

How to get the required info using this? I mean Campaign/Flow details.

 

Regards,

Jayadheer A

 

 

Userlevel 5
Badge +7

When you include that query param, events that have an attribution should have this block in the event object:

"attributions": {

    "data": [

        {

            "type": "attribution",

            "id": "5czsBzRaiB5"

        }

    ]

}

There will be an included block in the response that includes that ID:

"included": [

        {

            "type": "attribution",

            "id": "5czsBzRaiB5",

            "attributes": {},

            "relationships": {

                "event": {

                    "data": {

                        "type": "event",

                        "id": "5czsBzRaiB5"

                    }

                },

                "attributed-event": {

                    "data": {

                        "type": "event",

                        "id": "5cfHu3m2TVy"

                    }

                },

                "campaign": {

                    "data": {

                        "type": "campaign",

                        "id": "01HX185769CHRSH7AF5FBYEV1C"

                    }

                }

            },

Badge +2

Hi @saulblum ,

 

Thank you so much for this. I am able to fetch the required data now.

 

regards

Jayadheer A

Reply