Skip to main content
Solved

Metrics Grouped by Segment using metric-aggregate api

  • December 12, 2024
  • 1 reply
  • 25 views

Forum|alt.badge.img

I need to be able to report on how well a particular segment is doing, ideally being able to pull aggregate metrics such as products purchased, email, etc.

I noticed that there is optional Engagement metrics that can be generated on Segments, but there is no way to pull that data in via the API from what I can tell.

So that let me to metric-aggregate, which has a by field, which had me attempting something like this:

 

{

  "data": {

    "type": "metric-aggregate",

    "attributes": {

        "metric_id": "abcdef",

            "measurements": [

                "count"

            ],

        "filter": [

                   "greater-or-equal(datetime,2024-02-01T00:00:00)",

                   "less-than(datetime,2025-01-01T00:00:00)"

        ],

        "by": ["List"],

      "interval": "month",

      "page_size": 500,

      "timezone": "UTC"

    }

  }

}

Unfortunately this doesn’t group by segments or Lists, and instead has the following response

 

"data": [

                {

                    "dimensions": [

                        ""

                    ],

                    "measurements": {

                        "count": [

                            0.0,

                            0.0,


My question is: is there a way to get metrics for a particular segment?

Best answer by Mich expert

Hi,

Have you considered utilizing the API to fetch metrics directly from the segments you’re interested in? It seems like the way you’re currently aggregating metrics may not group by segments effectively.

To solve this, I can help you refine your API calls to ensure you’re filtering and grouping the data correctly based on the specific segments. With 5+ years of experience in handling APIs and data aggregation, I’m confident I can assist you in pulling the metrics you need.

I suggest we discuss your current setup and any additional requirements you have to ensure I provide the best solution

View original
Did this topic or the replies in the thread help you find an answer to your question?

1 reply

Mich expert
Problem Solver IV
Forum|alt.badge.img+11
  • Problem Solver IV
  • 64 replies
  • Answer
  • December 13, 2024

Hi,

Have you considered utilizing the API to fetch metrics directly from the segments you’re interested in? It seems like the way you’re currently aggregating metrics may not group by segments effectively.

To solve this, I can help you refine your API calls to ensure you’re filtering and grouping the data correctly based on the specific segments. With 5+ years of experience in handling APIs and data aggregation, I’m confident I can assist you in pulling the metrics you need.

I suggest we discuss your current setup and any additional requirements you have to ensure I provide the best solution