Segments
A segment is a named group of organizations. It is how you say "key accounts", "automotive", "dormant since spring" once, and then point pricing, campaigns and reports at it.
Kundengruppen, done properly
German B2B has always had Kundengruppen: the customer group that decides which price list, which assortment and which conditions apply. Most ERPs implement it as a single field on the customer record, which means a company is in exactly one group and somebody has to maintain it by hand.
A segment is the same idea without both of those limits. A company can be in several segments at once, and membership can be computed instead of typed.
Two ways to be a member
| Source | How it gets there | Survives a recompute? |
|---|---|---|
manual | You added the company by hand | Always. Never touched by rules. |
rule | The segment's rules matched it | Only while it still matches |
The two coexist in one segment. A company can be pulled in by a rule and be hand-picked, and hand-picked membership is never deleted, shadowed or reordered by a recompute. That is what makes "the rule, plus these three we always count" expressible.
Create a segment
- Go to CRM › Segments.
- Select New segment.
- Enter a Code: stable, unique per tenant, lowercase.
key-accounts,automotive,dormant-180d. This is what other systems reference, so treat it as permanent. - Enter the Name per locale.
- Save, then open the segment to add rules or members.
To add a member by hand, open the segment and use Add member on the Members list.
Rule-based segments
This is the same mechanism as rule-based categories in the catalog: deliberately the same rule language, the same manual/rule split, the same recompute. If you have built a rule-based category, you already know this.
A rule is a list of conditions plus a Rule match of all or any.
What the company is, its own columns:
name, status, branche, vat_id, external_team_id, and setting:<key>
for any top-level key of the organization's settings.
What the company did, its order behaviour:
| Field | Meaning |
|---|---|
revenue_total, revenue_30d / 90d / 365d | Sum of order totals, lifetime or rolling |
order_count, order_count_30d / 90d / 365d | Orders placed |
avg_order_value, avg_order_value_365d | Revenue divided by orders |
first_order_at, last_order_at | Absolute dates |
days_since_last_order | Days since the last order |
currency | The single order currency, empty when they mix several |
Operators: eq, neq, gt, gte, lt, lte, in, contains,
starts_with, ends_with, is_empty, is_not_empty.
Segments that earn their keep:
- Key accounts:
revenue_365d≥ 100000 - Automotive:
brancheinautomotive - Dormant:
days_since_last_order≥ 180 - Never ordered:
order_count= 0
last_order_at at all, so it is not "180 days since the
last order"; it matches nothing. Select those with order_count equal to 0 or
last_order_at is_empty. Getting this wrong means your reactivation campaign
silently skips every company that never got started, which is usually the group
you most wanted.Membership is computed on a schedule
Rule membership is materialized: a recompute writes the matching companies in as rule members and deletes rule members that stopped matching. Between recomputes, membership is what it was.
Two schedules govern this, and the order matters:
- Customer metrics refresh pulls revenue and order behaviour from the Orders app into the local projection.
- Segment recompute re-materializes the rule segments, using the numbers from step 1.
Both run daily by default and can be set to hourly or switched off. Off means a rule segment keeps the membership of the day somebody last recomputed it by hand, and every revenue rule then evaluates numbers that stopped moving.
Only orders that were actually placed count: placed, in_fulfillment and
completed. A pending order was never placed and a cancelled one is not revenue.
See The order lifecycle.
What to check
- The Segments list shows Last recomputed per segment. A blank or old timestamp on a segment with rules is the first thing to check when membership looks wrong.
- Open the segment and look at the Members list: each row shows whether it
arrived by
manualor byrule. - On a company's page, the Segments tab shows every segment it is in. Rule memberships are locked there; removing one only brings it back at the next recompute. Remove the company from the rule instead.
Next
- Contract prices for a customer — point a price at a segment.
- Customer data hygiene — keep the numbers behind the rules honest.