Skip to main content
Contributor II
February 8, 2024
Solved

Is there a way to add "all time" as the bucket on metrics calls?

  • February 8, 2024
  • 2 replies
  • 112 views

I have a use case where we’re trying to measure unique count of emails received (metric name: “recevied email”) on a flow, via the metric-aggregates API.  The issue is the following: 

The largest interval (bucket) is currently “month”, which means if a user receives an email on a flow on the last day of the month, and the following day in the next month, they are counted twice in the “unique” bucket since it is per interval.  Since the goal is to see total unique count of emails on a flow - this metric pull is unreliable.  For “orders” and purchases/sales, it’s fine since one can just reduce the bucket counts.

Is it on the roadmap to do a interval size “all”?

 

{
"data": {
"type": "metric-aggregate",
"attributes": {
"measurements": [
"count",
"unique"
],
"by": [
"$flow"
],
"filter": [ // filter spans >1 month
"greater-or-equal(datetime,2024-01-01T00:00:00.000Z)",
"less-than(datetime,2024-02-29T00:00:00.000Z)"
],
"return_fields":[
"name"
],
"metric_id": "K4eLyK", // K4eLyK = recevied email
"interval": "month", // <-- this would be great as "all"
"timezone": "UTC"
}
}
}

>            "detail": "'interval' must be one of: day, hour, month, week (got all)",

Curious if this is on the roadmap - seems like a “one” on interval would simplify things and might even be less resource-intensive on the server side.

    This topic has been closed for replies.
    Best answer by saulblum

    Hi, the date window is referring to when the event, such as Opened Email, happened, not when the email was sent. So if a campaign were sent December 31 but a profile opened the email January 1, the event count would be for the January data.

    You may be interested in the reporting API that’s coming with the 2024-02-15 revision next week, that will let you fetch campaign and flow performance analytics via API, as you can currently with the UI. Stay tuned!

    2 replies

    saulblumAnswer
    Klaviyo Employee
    February 8, 2024

    Hi, the date window is referring to when the event, such as Opened Email, happened, not when the email was sent. So if a campaign were sent December 31 but a profile opened the email January 1, the event count would be for the January data.

    You may be interested in the reporting API that’s coming with the 2024-02-15 revision next week, that will let you fetch campaign and flow performance analytics via API, as you can currently with the UI. Stay tuned!

    ambAuthor
    Contributor II
    February 8, 2024

    great, hopefully that will address it - essentially looking to pull the number of unique profiles that have entered a flow and received an email, during a date span. 

    The issue is mostly in the grouping/intervals and the way it makes it impossible to determine the true unique number of a metric when the window spans more than the largest interval (1 month).