Solved

Discrepancy between API endpoint /api/metric-aggregates/ and exported reporting data

  • 20 December 2023
  • 3 replies
  • 48 views

Badge +2

Hey Klaviyo team,

We extracted data for one of our clients using endpoint /api/metric-aggregates/.

However, the client complains about data discrepancy. For example, campaign with ID 01HBAV7QKRFSJ5NP8A12KC6SA4 in the exported reporting data has “Total Opens” = 15300:

But statistics for metric "Opened Email" (TaxZXt) returned 13462:

POST /api/metric-aggregates/ HTTP/1.1
Host: a.klaviyo.com
Authorization: Klaviyo-API-Key {{api_key}}
revision: 2023-10-15
Accept: application/json
Content-Type: application/json
Content-Length: 407

{
  "data": {
    "type": "metric-aggregate",
    "attributes": {
      "metric_id": "TaxZXt",
      "interval": "month",
      "measurements": [
        "count"
      ],
      "filter": [
        "greater-or-equal(datetime,2023-10-01T00:00:00)",
        "less-than(datetime,2023-11-01T00:00:00)"
      ],
      "by": [
        "$message"
      ],
      "page_size": 500,
      "timezone": "UTC"
    }
  }
}

Part of the response for campaign with ID 01HBAV7QKRFSJ5NP8A12KC6SA4:

                {
"dimensions": [
"01HBAV7QKRFSJ5NP8A12KC6SA4"
],
"measurements": {
"count": [
13462.0
]
}
},

Could you please clarify what’s a reason for the discrepancy?

 

Kind regards,

Evgeniy

icon

Best answer by saulblum 21 December 2023, 17:00

View original

3 replies

Userlevel 4
Badge +7

Hi, often these differences are from when the events are recorded. When you look at the email opens for a campaign, it will give you all the email opens, regardless of when they happened. When you use the API to query for specific events in a given time, it is only counting events that happened in that window. So if a campaign is sent September 15 and on November 1 you get all the campaign’s email opens, it will be around 45 days worth of events. If you use the API with a October 1 to November 1 window for email opens attributed to a campaign, it will only count email opens that happened during that month, and not include any email opens that happened between September 15 and 30.

Badge +2

Hi saulblum,

Thank you for looking here!

If I got right you explanation, the client exported all campaigns that were started in Oct 2023 with their lifetime metrics values.

I’ve checked “Total Opens” for the campaign 01HBAV7QKRFSJ5NP8A12KC6SA4 from starting till now and got value 13787 - it still many smaller then 1500.

Could you please explain it as well?

Kind regards,

Evgeniy

Userlevel 4
Badge +7

I’m assuming that Group column in the CSV export are segments? Is it possible that if a profile that opened an email from the campaign is in more than one of those six segments, they would be counted multiple times? The raw Opened Email count is segment-agnostic; it’s just tallying up Opened Email events. But if you’re breaking the profiles down by segments and a profile is in multiple segments, that event will count towards multiple rows, hence the inflated numbers.

 

Just a hunch.

Reply