@radzor/user-segmentation
Segment users based on attributes and behavioral rules. Define segments with filter expressions, evaluate users against them, and list matching segments. In-memory rule engine, zero dependencies.
Analyticsv0.1.0typescriptpythonServersegmentationuserstargetingcohortfilteranalyticsby Radzor
Install
View source on GitHub →$npx radzor@latest add user-segmentation
⚠ Constraints: Rules are evaluated synchronously in-memory. The cache stores the last evaluation per user — calling evaluate() overwrites the previous result. Supported operators: eq, neq, gt, gte, lt, lte, in, notIn, contains, startsWith, endsWith, exists, regex.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| segments | SegmentDefinition[] | — | Pre-defined segment definitions with filter rules. |
segmentsSegmentDefinition[]
Pre-defined segment definitions with filter rules.
Outputs
| Name | Type | Description |
|---|---|---|
| segmentResult | SegmentResult | Result of evaluating a user against segments. .userIdstring .matchedSegmentsstring[] .evaluatedAtnumber |