Design your customer structure

Segments

Group organizations so pricing and campaigns can target them, by hand or by rule.

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.

Before you start: segments select on organizations only, never on contacts or addresses. If you find yourself wanting "all approvers in DE", that is a contact filter, not a segment.

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

SourceHow it gets thereSurvives a recompute?
manualYou added the company by handAlways. Never touched by rules.
ruleThe segment's rules matched itOnly 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

  1. Go to CRM › Segments.
  2. Select New segment.
  3. Enter a Code: stable, unique per tenant, lowercase. key-accounts, automotive, dormant-180d. This is what other systems reference, so treat it as permanent.
  4. Enter the Name per locale.
  5. 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:

FieldMeaning
revenue_total, revenue_30d / 90d / 365dSum of order totals, lifetime or rolling
order_count, order_count_30d / 90d / 365dOrders placed
avg_order_value, avg_order_value_365dRevenue divided by orders
first_order_at, last_order_atAbsolute dates
days_since_last_orderDays since the last order
currencyThe 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: branche in automotive
  • Dormant: days_since_last_order ≥ 180
  • Never ordered: order_count = 0
"Dormant" and "never ordered" are different segments. A company that has never ordered has no 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:

  1. Customer metrics refresh pulls revenue and order behaviour from the Orders app into the local projection.
  2. 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 manual or by rule.
  • 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