Preview Audience
Count how many customers match an ad-hoc audience condition
cdp_preview_audience
Previews how many of your CDP customer profiles match an ad-hoc condition — a live count, with nothing saved. Use it to iterate on targeting before building a segment (segment writes are a later release).
Pass a condition object built from the public condition vocabulary — call cdp_list_properties for the allowed types, operators, and property paths. The condition is validated before it runs: script/MVEL resolvers, unknown condition types or operators, any scope/shopDomain predicate, and trees deeper than 8 or larger than 50 nodes are rejected with the offending JSON path. The brand scope is injected server-side, so the count only ever covers your own profiles.
Read-only and scoped to your brand.
Parameters
| Name | Type | Required | Description | Default |
|---|---|---|---|---|
condition | object | Yes | A Unomi condition object over profiles (see below). Must use the allowlisted vocabulary. | — |
A simple condition looks like:
{
"type": "profilePropertyCondition",
"parameterValues": {
"propertyName": "properties.orderCount",
"comparisonOperator": "greaterThan",
"propertyValueInteger": 3
}
}Combine several conditions with a booleanCondition (operator and / or, plus subConditions). Scope/shopDomain predicates are rejected — the owning scope is enforced by the server, not the caller.
Returns
count— the number of your in-scope profiles matching the condition.scope— your brand's shop domain.
Example prompts
How many of my customers have placed more than 3 orders?Preview an audience of customers tagged high_value who bought in the last 30 daysNotes
- Nothing is saved — this is a count-only preview.
- A rejected condition returns a validation error naming the offending JSON path, and no query runs.
- Call
cdp_list_propertiesfirst to get a vocabulary that validates by construction.