SegmentStats
Provides analytics data for segments, including member growth and engagement metrics over time.
Select
The add-in uses the Klaviyo API to process WHERE clause conditions with the following fields and operators. Remaining filters are evaluated client-side within the add-in.
- Granularity: Determines how granular the data points are within the time range specified by StartDateTime and EndDateTime. Specify this field if you want to query series stats. Valid values:
- hourly
- daily
- weekly
- monthly
- total (default)
- StartDateTime and EndDateTime: Define the time window. The window cannot exceed 1 year. If both values are provided, the add-in requests data for that range. If only one is provided, the add-in calculates the missing value based on the default interval for the selected granularity. Defaults:
- monthly or total: Last 1 year
- weekly: Last 52 weeks
- daily: Last 60 days
- hourly: Last 7 days
- SegmentId: Supports the operators: =, IN
Notes:
- Setting Granularity to total returns the same result as omitting it.
- If Granularity is hourly, the time window cannot exceed 7 days. For daily, 60 days. For weekly, 52 weeks. For monthly, 1 year.
- When Granularity is not total, IntervalStartDateTime and IntervalEndDateTime are based on the current interval. When set to total, they match the StartDateTime and EndDateTime.
- If only one of StartDateTime or EndDateTime is provided, the missing value is calculated internally using the default time span for the selected granularity.
- Only one filter can be applied to SegmentId.
- A maximum of 100 values can be specified for SegmentId when using the IN operator.
For example, the following query returns monthly segment stats for a defined time range and multiple segment IDs:
SELECT * FROM SegmentStats
WHERE Granularity = 'monthly'
AND StartDateTime = '2024-07-07'
AND EndDateTime = '2024-09-09'
AND SegmentId IN ('segment-1', 'segment-2', 'segment-3')
There are no required filters to query SegmentStats. However, it is recommended to specify a time window (StartDateTime and EndDateTime) and Granularity when you want to retrieve series stats (granular data).
-- Retrieve all segment stats without filters
SELECT * FROM SegmentStats
-- Retrieve stats for a defined time window
SELECT * FROM SegmentStats
WHERE StartDateTime = '2024-07-07'
AND EndDateTime = '2024-09-09'
-- Retrieve monthly stats for a defined time window
SELECT * FROM SegmentStats
WHERE Granularity = 'monthly'
AND StartDateTime = '2024-07-07'
AND EndDateTime = '2024-09-09'
Columns
| Name | Type | References | Description |
| MembersAdded | Int | The total number of profiles added to the segment during the specified time interval. | |
| MembersRemoved | Int | The total number of profiles removed from the segment during the specified time interval. | |
| NetMembersChanged | Int | The net change in the number of profiles within the segment, calculated as the MembersAdded field minus the MembersRemoved field. | |
| TotalMembers | Int | The total number of profiles currently included in the segment at the end of the specified interval. | |
| Granularity | String | Specifies the interval used to aggregate segment analytics data. Supported values include hourly, daily, monthly, and total. Hourly intervals support up to 7 days, daily up to 60 days, and monthly up to 52 weeks. Use StartDateTime and EndDateTime to define a shorter reporting window.
The allowed values are hourly, daily, weekly, monthly, total. | |
| IntervalStartDateTime | String | The start date and time of the analytics interval for the segment data. | |
| IntervalEndDateTime | String | The end date and time of the analytics interval for the segment data. | |
| SegmentId | String | The unique identifier of the segment associated with these analytics metrics. | |
| StartDateTime | Datetime | The start date and time of the reporting period for which segment analytics data is requested. | |
| EndDateTime | Datetime | The end date and time of the reporting period for which segment analytics data is requested. |