Sub topic 10
Combining behaviour, interest, and lifecycle
Earlier chapters built three kinds of segment on their own. A behavioural segment says what people did recently. An interest segment says what they care about. A lifecycle segment says where they are in their relationship with you. This chapter combines the three so one message can be specific to all of them without the audience shrinking to nothing.
This chapter assumes you can read basic SQL (SELECT, JOIN, GROUP BY, CTEs), that you understand AND, OR, and NOT, and that you know the segment rules, time windows, and consent filtering covered earlier. The examples use PostgreSQL and two tables:
subscribers(id, status, created_at, last_purchase_at)events(subscriber_id, event_type, topic, occurred_at)
Why combine dimensions
Each dimension answers a different question:
| Dimension | Question it answers | Example rule |
|---|---|---|
| Behaviour | Is this person engaged right now? | Clicked any email in the last 30 days |
| Interest | What is this person interested in? | Two or more running clicks in 60 days |
| Lifecycle | What is our relationship with this person? | Purchased in the last 90 days |
A single dimension often gives a message that is only half right. "Running content" sent to every running fan ignores whether they just bought shoes or have never bought. "Active customers" ignores what they care about. A combined segment lets you write something like "Your running shoes are about 90 days old. Here is what runners who bought them usually pick next." That is useful because it fits both the interest and the stage.
Combining has a cost. Every added condition removes people. The skill is choosing which dimensions to combine for a specific message, and stopping when the segment is no longer big enough to be useful.
The combination is an AND of segments
Each dimension produces a set of subscriber IDs. A combined segment is the intersection of those sets, which is a boolean AND:
combined = lifecycle AND interest AND behaviourYou can also use OR and NOT when they match the goal. For example, "interested in running AND NOT a new subscriber" removes people who have not yet had time to show real interest. Be deliberate about which operator you use, because mixing AND and OR without grouping is a common source of wrong segments. Always put parentheses around OR groups when writing rules.
Intersections do not depend on order, so the diagram's order only matters for readability and query performance. Consent is different: it is a precondition, not a preference. Put it at the start of every combined rule. The status = 'subscribed' check does this in the SQL below.
Building the combined segment step by step
The cleanest way to combine segments in SQL is one CTE (a named subquery) per dimension, then a join. Each CTE can be tested alone, and you can see which one removes the most people.
Step 1: lifecycle as the base
Lifecycle comes first because it is the only dimension that assigns every subscriber to exactly one value. The CASE expression evaluates its branches in order, so stages cannot overlap.
-- PostgreSQL: assign each subscribed contact exactly one lifecycle stage
SELECT id,
CASE
WHEN last_purchase_at >= now() - interval '90 days' THEN 'active_customer'
WHEN last_purchase_at IS NOT NULL THEN 'lapsed_customer'
WHEN created_at >= now() - interval '14 days' THEN 'new_subscriber'
ELSE 'prospect'
END AS lifecycle_stage
FROM subscribers
WHERE status = 'subscribed';Order matters here. A person who subscribed 5 days ago and bought yesterday matches both the first and third branches. Because active_customer is listed first, they are an active customer, not a new subscriber. If you want the opposite priority, reorder the branches. Decide the priority once and document it.
Step 2: interest as a filter
Interest is not a single click. It uses a count threshold and a window, so one stray click does not label someone.
-- PostgreSQL: subscribers who clicked at least twice on running content in the last 60 days
SELECT subscriber_id
FROM events
WHERE event_type = 'email_click'
AND topic = 'running'
AND occurred_at >= now() - interval '60 days'
GROUP BY subscriber_id
HAVING COUNT(*) >= 2;The query groups to one row per subscriber. That matters for the join in the next step. If you joined the raw events table instead, a subscriber with five clicks would appear five times.
Step 3: join them
-- PostgreSQL: active customers interested in running
WITH staged AS (
SELECT id,
CASE
WHEN last_purchase_at >= now() - interval '90 days' THEN 'active_customer'
WHEN last_purchase_at IS NOT NULL THEN 'lapsed_customer'
WHEN created_at >= now() - interval '14 days' THEN 'new_subscriber'
ELSE 'prospect'
END AS lifecycle_stage
FROM subscribers
WHERE status = 'subscribed'
),
running_interest AS (
SELECT subscriber_id
FROM events
WHERE event_type = 'email_click'
AND topic = 'running'
AND occurred_at >= now() - interval '60 days'
GROUP BY subscriber_id
HAVING COUNT(*) >= 2
)
SELECT st.id
FROM staged st
JOIN running_interest ri ON ri.subscriber_id = st.id
WHERE st.lifecycle_stage = 'active_customer';The inner JOIN keeps only subscribers present in both sets. Because staged already filters on status = 'subscribed', anyone who unsubscribed is dropped even if they clicked running emails last week.
Step 4: add behaviour
The query above already contains behaviour in a loose form, since the interest clicks are themselves engagement. Often you want a separate recency condition. For example, you may want to message only people who have clicked anything in the last 30 days, so the send goes to people who are reading your email now. You can reuse the existing check with EXISTS:
-- PostgreSQL: add a recent-engagement condition to the interest segment
SELECT s.id
FROM subscribers s
WHERE s.status = 'subscribed'
AND EXISTS (
SELECT 1
FROM events e
WHERE e.subscriber_id = s.id
AND e.event_type = 'email_click'
AND e.occurred_at >= now() - interval '30 days'
);Add this EXISTS block to the final query as another AND condition. EXISTS returns true or false per subscriber and cannot duplicate rows, which makes it a safe way to add a behavioural condition.
Measure each condition before you send
Combined segments fail quietly. The query runs, returns IDs, and the campaign goes out to a few dozen people. Before sending, count how many people each combination holds. This query groups subscribers by stage, interest flag, and recent-click flag:
-- PostgreSQL: size of every lifecycle x interest x behaviour combination
WITH staged AS (
SELECT id,
CASE
WHEN last_purchase_at >= now() - interval '90 days' THEN 'active_customer'
WHEN last_purchase_at IS NOT NULL THEN 'lapsed_customer'
WHEN created_at >= now() - interval '14 days' THEN 'new_subscriber'
ELSE 'prospect'
END AS lifecycle_stage
FROM subscribers
WHERE status = 'subscribed'
),
running_interest AS (
SELECT subscriber_id
FROM events
WHERE event_type = 'email_click'
AND topic = 'running'
AND occurred_at >= now() - interval '60 days'
GROUP BY subscriber_id
HAVING COUNT(*) >= 2
),
recent_clickers AS (
SELECT DISTINCT subscriber_id
FROM events
WHERE event_type = 'email_click'
AND occurred_at >= now() - interval '30 days'
)
SELECT st.lifecycle_stage,
(ri.subscriber_id IS NOT NULL) AS has_running_interest,
(rc.subscriber_id IS NOT NULL) AS clicked_last_30_days,
COUNT(*) AS segment_size
FROM staged st
LEFT JOIN running_interest ri ON ri.subscriber_id = st.id
LEFT JOIN recent_clickers rc ON rc.subscriber_id = st.id
GROUP BY st.lifecycle_stage,
(ri.subscriber_id IS NOT NULL),
(rc.subscriber_id IS NOT NULL)
ORDER BY segment_size DESC;The output is a grid of every combination with its size. Read it before deciding. Some cells will be large, and some will hold a handful of people. Those small cells are the ones to merge or drop.
Keeping combined segments useful
Set a minimum size
Pick a floor before you look at the numbers. The right floor depends on your list and on what you plan to measure. If you intend to compare results against a control group, you need enough people in both halves for the difference to mean anything. A segment of 40 people cannot support a reliable test. Treat any floor as a team decision and write it down.
Relax the least important condition first
When a segment is too small, loosen one condition at a time, in this order of preference:
- Widen a time window (60 days to 90 days).
- Lower a count threshold (2 clicks to 1 click).
- Merge adjacent lifecycle stages, such as
active_customerandlapsed_customer. - Drop a dimension and write the message for the remaining two.
Do not loosen consent or subscription status. Those are limits, not tuning knobs.
Use fewer dimensions per message
Three dimensions on every campaign is not a goal. Many good campaigns use one or two. Use the third only when it changes what the message says. If an active customer interested in running and an active customer interested in trail hiking would get the same email, the interest dimension is adding complexity without value for that campaign.
Common errors
- Mismatched windows. A 30-day behaviour window combined with a 90-day lifecycle window can describe people who bought recently but have not engaged, which may be exactly what you want or a bug. State what each window means in the segment name or notes.
- Overlapping send groups. If you run separate campaigns for "active customers interested in running" and "active customers interested in cycling", a subscriber who clicked both topics lands in both. Decide on a rule: send both, pick the stronger interest, or suppress duplicates within a day.
- NULL surprises.
last_purchase_at >= now() - interval '90 days'is not true for a NULL value. TheCASEabove relies on this and then handles NULL explicitly in the second branch. If you write aNOTcondition, check how NULL behaves. - Stale event data. If tracking breaks for a week, behaviour segments drain quietly. Compare segment sizes between runs and investigate sudden drops.
- Ignoring Apple Mail Privacy Protection. Open events can be automated, so use clicks and site or purchase events for behaviour where you can. The engagement signals chapter covers this in detail.
Naming and documenting the result
A combined segment is only reusable if someone else can tell what it contains. Name it so the three dimensions and windows show up, for example active-customer | running-2x-60d | clicked-30d. Record the owner, the date, and the campaign goal. The next chapter returns to naming and maintenance.
Exercise
Your size query shows 12 people in "activecustomer, running interest, clicked in last 30 days", 480 in "activecustomer, running interest, no recent click", and 2,100 in "active_customer, no running interest, clicked in last 30 days". You want to send a running accessories offer to active customers. Which segment do you send to, and which condition do you relax to reach it?
Show answer
Send to the 492 active customers with running interest, and drop the 30-day click condition. The 12-person cell is too small to send to or test on its own. Dropping the behaviour condition keeps both lifecycle and interest, which are the two dimensions that change what the offer says. If you need to keep engagement in the rule, widen the click window (for example to 60 or 90 days) instead of removing it. The 2,100-person group has no running interest, so a running offer would not fit it. You should also confirm that all 492 are still subscribed.