Skip to main content
Solved

Where can I get Revenue Data in the API?

  • October 12, 2022
  • 4 replies
  • 659 views

Forum|alt.badge.img+3
  • Active Contributor I
  • 14 replies

Hi!

I was wondering if it was possible to get Revenue data through the endpoint Query Event Data? https://developers.klaviyo.com/en/reference/metric-export If not, is there another endpoint through which it is available?

I use this endpoint to get data for all other metrics (ex: number of Clicked Emails, Opened Emails, etc).

And when I look at the glossary https://help.klaviyo.com/hc/en-us/articles/360037957832-Analytics-Glossary#r15, there are Revenue metrics that would be interesting to get.

 

Thank you!

Best answer by David To

Hello @Nymesia,

I would suggest checking out our How to Export Conversion Data Help Center if you haven’t already. Oftentimes, revenue is not actually a metric (unless it was custom coded). Rather, revenue is a calculation based on the value of a specific metric such as a Placed Order event/metric.

As highlighted in the Revenue subsection; you can calculate revenue based on your desired measurement  of a specific event value using something like the below:

curl https://a.klaviyo.com/api/v1/metric/PLACEDORDERMETRIC/export -G \
    -d api_key=API_KEY \
    -d unit='week' \
    -d measurement='value' \
    -d where='[["$attributed_message","=",'MESSAGE_ID']]'

You may also find this Community post which I’ve commented on below helpful:

David

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

4 replies

David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • Answer
  • October 13, 2022

Hello @Nymesia,

I would suggest checking out our How to Export Conversion Data Help Center if you haven’t already. Oftentimes, revenue is not actually a metric (unless it was custom coded). Rather, revenue is a calculation based on the value of a specific metric such as a Placed Order event/metric.

As highlighted in the Revenue subsection; you can calculate revenue based on your desired measurement  of a specific event value using something like the below:

curl https://a.klaviyo.com/api/v1/metric/PLACEDORDERMETRIC/export -G \
    -d api_key=API_KEY \
    -d unit='week' \
    -d measurement='value' \
    -d where='[["$attributed_message","=",'MESSAGE_ID']]'

You may also find this Community post which I’ve commented on below helpful:

David


Forum|alt.badge.img+3
  • Author
  • Active Contributor I
  • 14 replies
  • October 14, 2022

Hi David,

 

Thanks a lot for the info! It makes sense to get the revenue from Placed Order (and other similar metrics) actually! And the “measurement=value” API parameter is very helpful: I misread the endpoint documentation and did not know we could do that!

 

Thanks again and have a great day!

 

Marie


Forum|alt.badge.img+1
  • Contributor I
  • 3 replies
  • May 30, 2023

Hi! I am also trying to get the Revenue Data in the API, along with Open Rate and Click rate for campaigns and flows. What’s confusing is that the referenced help center article https://help.klaviyo.com/hc/en-us/articles/360040093732 and the referenced earlier answer refer to API v1. This is not its current version. And then the article refers to “PLACEORDERMETRIC”. Is this the real name or do I need to replace it with the real one? Where do I get the metric IDs or names (to be used in the API requests) and are these unique to an account? I need the metrics Open Rate, Click Rate, the Delivered messages number, and Placed Order Value. Can you please give a comprehensive explanation how to export these from the current API version? 


Brian Turcotte
Forum|alt.badge.img+37

Hi @IrinaK!

I noticed you asked a similar question here, where I’ve left a lengthier response:

 

As I mentioned in that response, the best way to accomplish this would be to use our V3 Query Metric Aggregates endpoint. Here’s a useful, updated guide on how to use this endpoint:

 

As for the Metric ID, this can be found in the Klaviyo UI by navigating to Analytics > Metrics > Search for metric > Click on metric. The Metric ID will be located in the URL of this page, like so:

https://www.klaviyo.com/metric/METRIC_ID/metricname

 

Best,

Brian