Register a Behavior Query
Registers an asynchronous Behavior analysis query and returns a request_id. Behavior analysis measures how many users perform one or more events over a time range, broken down by the dimensions you choose.
Use the request_id with Get Query Status to poll for completion, then Get Query Results to fetch the resolved series.
Authorizations
Authentication is done via Basic Auth. This requires a base64-encoded string of your credentials in the format username:password.
- Username: Use your MoEngage workspace ID (also known as the App ID). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
- Password: Use your Data API Key, which you can find in the MoEngage dashboard at Settings > Account > APIs.
For more information, see Authentication.
Body
Request body for registering a Behavior analysis query.
The analysis type. Must be behavior for this endpoint.
behavior The behavior metric to compute — for example, events (event counts), users (users who performed the event), or a per-user aggregation.
events, users, session, aggregation, aggregation_distribution, total_events_per_user, attribute_aggregation_per_user The events to analyze. Include 1 to 10 events. Each event has an id, one or more actions (event + attribute filters), an optional split_by, and an optional aggregation.
1 - 10 elementsSegments used to scope the analysis to a subset of users. Include up to 5 segments. To analyze all users, pass a single segment with the All Users custom segment.
5The time window the analysis runs over.
Time bucket for the series — for example, d (day), w (week), m (month), h (hour), or e (entire range). When hourly, the time range must not exceed 31 days.
"d"
Payload schema version.
"2.0"
User attributes to group the results by. Include up to 10; the combined total with all split_by entries must not exceed 10.
10Custom distribution configuration. When using custom buckets, include at most 10 buckets. Pass an empty object for no custom distribution.
Visual representation of the result, such as line, column, or bar.
"line"
Whether metrics are returned as absolute counts or percentages, such as number.
"number"
Plot scale for the chart, such as linear.
"linear"
Rolling-window size for the metric, or -1 when not used.
-1
The per-user aggregation to apply. Empty when not using an aggregation.
""
Percentile to compute when user_aggregation_type is a percentile aggregation. A value from 1 to 100, or -1 when not used.
-1
A second time range to compare against. Time comparison is supported only on line, bar, and column charts, and cannot be combined with custom-segment comparison (2 or more segments). Pass an empty object for no comparison.
Sort order applied to the result series.
ascending, descending Response
Query registered. Poll status and fetch results with data.request_id.
Acknowledgement that a query was registered. Use data.request_id to poll status and fetch results.