Solved

How can I find Placed Order/Revenue Metrics from Flows/Campaigns via API?

  • 17 February 2022
  • 6 replies
  • 659 views

Badge +2

Hi all,

Is there any update w/r/t revenue and placed order metrics being available in the Flows and Campaigns API? If not, then if there is any sort of workaround for now I would be very interested!

Thanks!

icon

Best answer by Taylor Tarpley 18 February 2022, 21:27

View original

6 replies

Userlevel 7
Badge +60

Hi @noteconsole

 

Thanks for sharing your question with us! 

 

Yes there is a way to retrieve what you’re looking for! You can actually utilize Klaviyo’s /export endpoint as part of the Metric’s API while leveraging the ID of your conversion metric within your account to return both your campaign and flow revenue via API. David goes through a similar question from a user in the topic below! 

 

Thanks for your participation in the Community!

-Taylor 

Badge +2

Hi @Taylor Tarpley,

I've read otherwise that the revenue and placed orders metrics are not yet supported in the Campaign and Flows APIs (see here for @Dov’s response ). In my experience in making API requests for these metrics I always get 0.0 values for certain campaigns and flows I know to have non-zero revenue and/or placed orders values. See my example request below:

url = "https://a.klaviyo.com/api/v1/metric/"+PLACEDORDERMETRIC+"/export?start_date="+startDate+"&end_date="+endDate+"&where=%5B%5B%22%24message%22%2C%22%3D%22%2C%22"+campaignID+"%22%5D%5D&unit=‘day’&measurement=‘value’&api_key="+api_key

 

Any help is greatly appreciated! Thanks

Userlevel 7
Badge +60

Hi @noteconsole,

 

So yes, is true for making reports from the findings via API. However, if you are just looking to capture the metrics from campaign and flow API’s you can do that through David’s workflow in the topic i linked above! If that’s not your overall goal, do you mind sharing what is? 

 

If you want to pull revenue/placed order events regardless of attribution source, they can definitely pull this from your ecommerce platform. Or you wanted to pull revenue based on a specific attributed email within Klaviyo, there isn't a simply one call to pull it. You’ll need to make a handful of calls specifying which email you want to pull the revenue for. Placed Order is certainly a supported metric we pull for and Dov actually explains this really well for flows in his response to the community post you linked!

 

In a similar fashion, if you wanted to pull revenue for attributed campaigns you’ll want to use the endpoint explained in the Revenue subsection of the How to Export Conversion Data Help Center article, uncde the tittle “placed order" event.

 

Finally, as even a slight added or missing space or symbol can make a call unsuccessful, I would also ensure everything is right in your code to be sure there are no missing elements! 

 

Hope this helps!

-Taylor 

Badge +1

thank you but i am getting the same results all the values in 0, i check and my call is fine 

 

Badge +1

HI @Taylor Tarpley @noteconsole 
 

 i am trying to use this but even when the call is successfully done the answer is giving me all 0 cero values , even when i know that those flows ids or messages id have values 

here my call

https://a.klaviyo.com/api/v1/metric/X8K8GZ/export?start_date=2021-11-01&end_date=2021-11-30&unit=week&measurement=value&where=%5B%5B%22%24attributed_message%22%2C%22%3D%22%2C%22Wf6rLC%22%5D%5D&api_key=MYAPIKEY

 

Userlevel 7
Badge +60

Hi @Jolguer

 

Thanks for sharing your question with the Community! 

 

Thanks for sharing out the call with us, it helped us figure out what might be going on here. I’m glad to hear that it seems like my colleague @David To provided some helpful suggestions in the thread below. It seems the issue stemmed from the call being made incorrectly. 

 

Thanks for being a part of our Community!

-Taylor  

Reply