Export Conversion Data

read
Last updated at:

Overview

If your company houses information in a data warehouse, you will likely want to sync your Klaviyo metrics and conversion data in there as well. In this article, you will learn how to export conversion metrics and dates.

Exporting Your Metrics

Campaign Names (campaign_names)

To export campaign names, do the following:

curl https://a.klaviyo.com/api/v1/campaigns -G \ -d api_key=API_KEY

Unique Opens (unique_opens)

When calculating who opens your emails, you can measure for non-unique (the number of total opens, which can include multiple per email address) or unique opens (the number of opens, one per email address).

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

Open Rate (open_rate)

To calculate open rate, take your total delivered (received) emails and divide that by the number of total opens (either unique or non-unique).

First, get the total opens or unique opens of a message ID with the following: 

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

Then, get the total received or uniques of a message ID:

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

From there, divide your calculation for opens by deliveries to get your open rate (opens ÷ delivered = open rate).

Unique Clicks (unique_clicks)

When calculating who clicks into your emails, you can choose to measure for non-unique (the number of total clicks, which can include multiple per email address) or unique clicks (the number of clicks, one per email address).

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

Click Rate (click_rate)

To calculate click rate, take the total delivered (received) emails and divide that by the total clicks (either unique or non-unique).

First, find the number of total clicks or unique clicks of a message ID.

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

Then, find the total received or uniques of a message ID.

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

Next, divide your calculation for clicks by deliveries to get your click rate (clicks ÷ delivered = click rate).

Conversions

To calculate conversions, use your desired measurement value (e.g., placed_order).

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

Revenue

To calculate revenue, use your desired measurement value (e.g., placed_order).

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']]'

Exporting Dates

When exporting data from the metric/export, if the feature is set to days, you can only grab 31 days at a time. In this case, we recommend formatting your date range from the first to the last day of each month.

For example:

start_date = 2021-01-01
end_date = 2021-01-31

Additional Resources

x
Was this article helpful?
5 out of 16 found this helpful