Skip to main content

When using the Query Metric Aggregates API for fetching the “Placed Order Metrics”, we are getting “campaign-id” as dimension for the “Email Campaigns”, and “campaign-message-id” as the dimension for the “SMS Campaigns”.

This is blocking us from using the API output correctly.

 

As per another community ticket, the intended behaviour is that the dimensions are “campaign-ids”.  We’re seeing a different behaviour from the Klaviyo APIs now.

 

Here is the payload we’re using for fetching the data:

{
"data": {
"type": "metric-aggregate",
"attributes": {
"metric_id": "<PLACED_ORDER_METRIC>",
"measurements": T
"count"
],
"filter":
"greater-or-equal(datetime,2024-10-01T00:00:00)"
, "less-than(datetime,2025-01-24T00:00:00)"
, "not(equals($attributed_message,\"\"))"
],
"interval": "month",
"page_size": 500,
"by":
"$attributed_message"
],
"timezone": "UTC"
}
}
}

 

 

@Brian Turcotte ​@chloe.strange 

Hello ​@vaibhavrai2446 ,

The issue you're encountering with the Query Metric Aggregates API likely stems from inconsistencies in how Klaviyo dimensions are structured for email and SMS campaigns. Ideally, both should use "campaign-ids" for consistency. To address this:

1. Double-check Klaviyo's API documentation for any recent updates regarding dimension behavior for "Placed Order Metrics."

2. If the issue persists, try a workaround by normalizing the output dimensions in your data pipeline to handle both "campaign-id" and "campaign-message-id."

3. Contact Klaviyo support or your Klaviyo account manager to confirm if this behavior is intentional or a bug.

 

If this seems complex, feel free to reach out, and I can assist with implementing a robust solution.