Sub topic 6
Choosing an inactivity window for your cadence
This chapter assumes you know basic email marketing terms (list, campaign, bounce, unsubscribe), how an email service provider sends mail, and enough SQL or Python to read a query. The previous chapter defined an engaged subscriber as one who clicked or purchased. Here you decide how long a subscriber can go without doing either before you act.
What the window is
The inactivity window is the number of days without an engagement event after which a subscriber counts as inactive. It is the main setting in a sunset policy. If it is too short, you lose people who would have bought later. If it is too long, dead addresses stay on your list and keep dragging down your reputation.
Tie the window to your cadence
A window is only meaningful relative to how often you send. A subscriber who has received two emails and ignored both tells you little. One who has received forty tells you a lot.
A practical rule is to require a minimum number of sends inside the window. Count the messages you expect to send in the period, then check that the number is large enough to judge engagement fairly.
| Sending cadence | Messages in 180 days | Reasonable starting window |
|---|---|---|
| Daily | about 180 | 60 to 90 days |
| Weekly | about 26 | 120 to 180 days |
| Monthly | about 6 | 270 to 365 days |
| Seasonal or irregular | varies | Count sends, not days |
Treat these numbers as starting points. Adjust them using your own data in the next section.
Check the window against your data
Look at how late engagement actually happens. For subscribers who clicked or purchased, measure the gap between consecutive engagement events. If 95% of gaps are under 120 days, a 180-day window leaves a safe margin. If many customers return after 300 days, such as people who buy once a year, a 180-day window will wrongly flag them.
You can also test a window by asking what share of "inactive" subscribers later came back. Take a past date, apply a candidate window, and count how many flagged subscribers engaged in the following 90 days. A high return rate means the window is too aggressive.
Find candidates with a query
The PostgreSQL query below lists subscribed addresses that joined more than 180 days ago and have no click or purchase in the last 180 days. It counts clicks and purchases rather than opens, for reasons covered earlier.
SELECT s.id,
s.email,
MAX(e.occurred_at) AS last_engaged_at
FROM subscribers s
LEFT JOIN engagement_events e
ON e.subscriber_id = s.id
AND e.event_type IN ('click', 'purchase')
WHERE s.status = 'subscribed'
AND s.subscribed_at < now() - interval '180 days'
GROUP BY s.id, s.email
HAVING MAX(e.occurred_at) IS NULL
OR MAX(e.occurred_at) < now() - interval '180 days';The subscribed_at filter protects new subscribers who have not had time to engage. The LEFT JOIN keeps people with no events at all, and the HAVING clause catches them through IS NULL. To try a different window, change both 180 days values together.
Turn the window into stages
The window alone gives a yes or no answer. A policy needs stages, so each subscriber is in a known state. The function below maps a subscriber to one of four stages: active, send a re-engagement message, wait out the grace period, or suppress.
from datetime import datetime, timedelta
def sunset_stage(
subscribed_at: datetime,
last_engaged_at: datetime | None,
reengagement_sent_at: datetime | None,
now: datetime,
window_days: int = 180,
grace_days: int = 30,
) -> str:
reference = last_engaged_at or subscribed_at
if now - reference < timedelta(days=window_days):
return "active"
if reengagement_sent_at is None:
return "send_reengagement"
if now - reengagement_sent_at < timedelta(days=grace_days):
return "waiting"
return "suppress"The line reference = last_engaged_at or subscribed_at starts the clock at signup for people who never engaged. That gives a new subscriber a full window before any action.
Common errors
- Using one window for every list. A daily deals list and a quarterly newsletter need different windows. Set one per stream.
- Counting opens as engagement. Privacy features can inflate opens, so a subscriber who "opens" may never have seen the message.
- Ignoring send volume. A subscriber who received only three messages has not had a fair chance to engage.
- Changing the window and the grace period at once. You cannot tell which change caused a shift in results.
- Starting the clock at the wrong date. Use the last engagement, or the signup date if there is none.
Exercise
A monthly newsletter has 4,000 subscribers. One subscriber joined 200 days ago, received about 6 emails, and never clicked or purchased. With the default settings in sunsetstage (windowdays=180), and no re-engagement message sent yet, what stage does the function return? Is a 180-day window a good fit for this cadence?
Show answer
The function returns "sendreengagement", because 200 days exceeds the 180-day window and reengagementsent_at is None. A 180-day window is on the short side for a monthly cadence. The subscriber has had only about 6 chances to engage, so a window of 270 to 365 days would be a safer starting point.