Skip to main content
Solved

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


Forum|alt.badge.img+3

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

 

Best answer by saulblum

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"

                    }

                }

            },

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • May 3, 2024

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

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

 


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • May 3, 2024

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.

 


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 6 replies
  • May 6, 2024

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

 

 


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • May 6, 2024

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"

                    }

                }

            },


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 6 replies
  • May 8, 2024

Hi @saulblum ,

 

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

 

regards

Jayadheer A