Skip to main content
Solved

Query Metric Aggregates endpoint and Supported attributes are ambiguous

  • 18 July 2024
  • 7 replies
  • 52 views

Hi everyone,

I'm trying to query revenue metrics such as Placed Order. According to the documentation:

 

This information appears to be incorrect, as the provided values are actually Campaign IDs and Flow MESSAGES IDs. Initially, I assumed I could distinguish campaign IDs by their character length. However, I discovered that some Campaign IDs are shorter, similar to Flow or Flow Message IDs. This discrepancy complicates my data mapping and combination across different tables, making the API response somewhat unclear.

Additionally, I’m struggling to find detailed explanations for the supported attribute metrics. For instance, what exactly is a $message? What kind of data does it return? Does it include both Campaigns and Flows, or just Campaigns?

While the endpoint itself is useful, the response structure could use improvement.

Thanks for your help!

7 replies

Userlevel 5
Badge +8

Hey @portermetrics, thanks for the feedback. There is some discussion on the attributes + the ability to filter down to campaigns only (for example) in this post. 

 

We released Campaign & Flow Reporting APIs earlier this year that should be a lot easier to use for this task! We just published a guide that should help you to get up and running with them: https://developers.klaviyo.com/en/reference/reporting_api_overview 

You should be able to use the Placed Order metric ID as the “conversion_metric_id”. Then, you might include statistics like “conversions”, “conversion_uniques”, and “conversion_value” in your request. Your responses would be grouped by campaign (for the campaign api) and flow/flow message (for the flow api) and should be easy to map back to the corresponding campaigns & flows/flow messages.

Badge +1

Hi @Kim Strauch, thank you for your fast reply. Quick question: Do the Campaign & Flow Reporting APIs support Campaign or Flow time ranges, or is it a Metric time range?

Once again, thank you for your help!

 

Userlevel 5
Badge +8

Good question, @portermetrics! The Campaign & Flow Reporting APIs support the “Campaign or flow time range”; whereas, Query Metric Aggregates supports the “metric time range”. 

Badge +1

Hi @Kim Strauch I found a case where I’m retrieving Placed Orders by $attributed_message. Based on the documentation it should return Campaign IDs and Flow Messages Ids, but both of them return a 404 not found (for the same dimension ID). Why is this happening? This endpoint returns metrics for deleted messages? How to avoid this from happening? Please let me know if you need further information.

Thank you once again

Userlevel 5
Badge +8

@portermetrics are you able to share some of the IDs you’re querying that are returning 404s? Will ask the team to take a look. Thanks! 

Badge +1

Hi Kim, thanks for the fast response. This id RBmkF5  is one of them. Would you need anything else? Let me know! 

Userlevel 5
Badge +8

Thanks @portermetrics. I wasn’t able to locate an object with this ID so I suspect it was deleted. 

After checking with the team, it appears this endpoint doesn’t filter out deleted messages so there is a risk that some of these will 404

Reply