Segmentation

Segmentation

Segments are nested AND/OR trees over the merged profile. Missing traits fail closed. If a rule needs country=US and country is absent, the campaign does not match.

When matching runs

On each decision, Meridian Ads merges this request's context into the profile for (app_id, user_key), then evaluates the campaign's segment on that merged map. Redis is the hot copy. Postgres is durable and updated off the serve path.

Operators

OpMatchMissing trait
eqTrait equals valueNo match
inTrait equals any entry in valuesNo match
rangeNumeric trait between optional min and maxNo match (also no match if the value is not numeric)
existsTrait is present and not nullFalse (no match)

Boolean nodes use and or or with nested children. Default combination is AND. An empty node (no rule, no children) matches everyone.

Example

US or CA, on the pro plan. If country is omitted, the in child fails and the whole AND fails.

JSON
{
  "op": "and",
  "children": [
    {
      "rule": {
        "trait": "country",
        "op": "in",
        "values": ["US", "CA"]
      }
    },
    {
      "rule": {
        "trait": "plan",
        "op": "eq",
        "value": "pro"
      }
    }
  ]
}