Sub topic 6
Choosing an inactivity window for your cadence
This chapter assumes you know the basic email terms (list, campaign, bounce, unsubscribe). It also assumes you can query subscriber data with SQL or a script. Earlier chapters defined an engaged subscriber using clicks, purchases, and other signals that don't depend on open tracking. Here you decide how long a subscriber can go without any of those signals before you act.
What the window is
The inactivity window is the number of days without a qualifying engagement event after which a subscriber is a candidate for re-engagement and, later, suppression. The window is not a measure of whether a person likes your mail. It is a threshold you set, and it trades two errors against each other:
- Window too short: you flag people who would have engaged on the next send. You lose revenue and shrink the list for no deliverability gain.
- Window too long: you keep mailing people who will never respond. Their non-engagement keeps counting against you with mailbox providers, and you keep sending to addresses that may have turned into spam traps or bounces.
No universal number is correct. A common starting range is 90 to 365 days, but a daily retailer and a quarterly newsletter need very different values inside that range.
Why cadence drives the window
Time is the wrong unit on its own. The useful question is how many chances the subscriber has had to engage. If you send 16 emails a month, 60 days of silence means about 32 ignored messages. If you send one email a month, 60 days means two ignored messages, which says almost nothing.
Think of the window as opportunities × spacing:
- Decide how many ignored sends you consider strong evidence of disinterest. Many programs use somewhere between 6 and 12, but treat that as a hypothesis to test.
- Multiply by the average days between sends that the subscriber actually received.
- Apply a floor and a ceiling so the result is never absurdly short or long.
The "actually received" part matters. If you segment, a subscriber who is in a segment that gets 2 emails a month has had fewer opportunities than your total sends suggest. Count sends per subscriber where you can.
def window_days(
sends_per_month: float,
min_sends: int = 8,
floor_days: int = 60,
ceiling_days: int = 365,
) -> int:
"""Return an inactivity window in days for a given sending cadence."""
if sends_per_month <= 0:
raise ValueError("sends_per_month must be positive")
days_between_sends = 30.4 / sends_per_month
raw = days_between_sends * min_sends
return int(min(max(raw, floor_days), ceiling_days))
for cadence in (16, 8, 4, 1, 0.25):
print(f"{cadence:>5} sends/month -> {window_days(cadence)} days")Running this prints:
16 sends/month -> 60 days
8 sends/month -> 60 days
4 sends/month -> 60 days
1 sends/month -> 243 days
0.25 sends/month -> 365 daysThe floor does most of the work for frequent senders. Without it, a daily sender would get a window of about eight days, which would flag people who were simply on vacation. The ceiling stops quarterly senders from waiting nearly three years.
Pick the window from your own data
A formula gives a starting point. Your data should confirm or change it. The question to ask is: how long do real customers go quiet and then come back?
The query below computes the gap between consecutive qualifying events (clicks or purchases) for each subscriber, then reports percentiles of those gaps in days. It assumes the engagement_events table from the earlier chapters.
WITH gaps AS (
SELECT subscriber_id,
occurred_at
- LAG(occurred_at) OVER (
PARTITION BY subscriber_id
ORDER BY occurred_at
) AS gap
FROM engagement_events
WHERE event_type IN ('click', 'purchase')
)
SELECT percentile_cont(ARRAY[0.5, 0.9, 0.95, 0.99])
WITHIN GROUP (ORDER BY extract(epoch FROM gap) / 86400)
AS gap_days_p50_p90_p95_p99
FROM gaps
WHERE gap IS NOT NULL;Read the result as follows. If the 95th percentile gap is 140 days, then 95% of the comebacks you observed happened within 140 days of the previous engagement. A window of 90 days would flag many people who later returned. A window near or above 140 days would catch most of them before you act.
The survivorship caveat
This query only sees gaps that ended with an engagement. Subscribers who went quiet and never came back produce no gap, so they are invisible. The percentiles therefore describe returners, and they tell you how long a window must be to avoid cutting off most of them. They do not tell you how many people are gone for good. Combine this view with the share of your list that has had no click or purchase for 90, 180, and 365 days.
Test the window with a holdout
If you can, validate with a small experiment. Take a random sample of subscribers who cross the candidate threshold and keep mailing them normally. Run the re-engagement flow for the rest. Then compare, over the next 60 to 90 days, how many of the holdout group engage without being prompted. If very few do, a shorter window may be safe. If a meaningful share do, lengthen the window.
Keep the holdout small and time-boxed. Its purpose is to measure, not to preserve a bad list.
Segment-specific windows
One window for the whole list is easy to run, but cadence and behavior often differ by segment. Consider separate windows when:
- You send different volumes to different groups (for example a weekly newsletter and a monthly promotions list).
- Customers and non-customers behave differently. People who have purchased often tolerate long silences and still buy later.
- Subscribers came from different sources, such as checkout opt-ins versus a contest. Low-intent sources usually go quiet sooner.
Every extra window adds rules you have to document, automate, and explain. Start with one window per distinct cadence, and add segments only when the data shows a clear difference.
| Program type | Typical cadence | Starting window to test | Reason |
|---|---|---|---|
| Daily deals or news | 15 to 30 sends per month | 60 to 90 days | Many opportunities per week. Silence accumulates quickly. |
| Weekly newsletter | 4 sends per month | 90 to 120 days | About 12 to 16 ignored sends is solid evidence. |
| Monthly digest | 1 send per month | 180 to 270 days | Needs months to collect enough opportunities. |
| Seasonal or event-based | Irregular | 365 days or more, anchored to the season | A silent summer may be normal for a winter-goods buyer. |
These are starting points to test against your own gap percentiles, not rules.
Where the clock starts
The window needs a reference date. The function from the policy section of this tutorial uses the last engagement and falls back to the subscription date when the subscriber has never engaged:
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"Three details about the reference date cause most real-world mistakes:
- New subscribers. A subscriber who joined 20 days ago has no engagement history, and the fallback to
subscribed_atprotects them. The window is then measured from signup, which gives new people a full window before any action. - Imports and migrations. If you load an old list and stamp everyone with today's date as
subscribed_at, you silently give dead addresses a fresh window. Preserve the original opt-in date when you have it. When you don't, treat the import date as the start and expect a delayed cleanup. - Event gaps. If click tracking broke for three weeks, many people will look inactive for reasons unrelated to them. Check for gaps in event collection before you trust a window calculation, and exclude or extend the affected period.
How the pieces fit
Common errors
- Using open data to set the window. Opens are inflated by mail privacy features and image prefetching. A subscriber who "opened" last week may be a machine. Base the window on clicks, purchases, and other deliberate actions.
- Ignoring the cadence change. If you double your volume next quarter, a window tuned to the old cadence now covers twice as many ignored sends. Review the window when volume changes by more than a third or so.
- Setting the window once and never revisiting it. List composition changes. Recompute the gap percentiles at least twice a year.
- Counting transactional mail as an opportunity. Order confirmations and password resets are opened and often clicked for functional reasons. Decide deliberately whether they count as engagement. Most programs exclude them from the engagement definition, and the next chapters cover how to handle them as exceptions.
- Making the window equal to the suppression deadline. The window only starts the process. A re-engagement message and a grace period follow before anyone is suppressed, so the total time from last engagement to suppression is the window plus the grace period.
Checklist for this chapter
- Calculate sends per month for each distinct cadence in your program.
- Derive a candidate window with a floor and ceiling.
- Run the gap-percentile query and compare the 95th percentile with your candidate.
- Count how many subscribers would be flagged now, so you know the scale of the first batch.
- Write down the reference date rule, including how imports and tracking gaps are handled.
Exercise
A newsletter sends 2 emails per month. You want 8 ignored sends as the evidence threshold, with a floor of 60 days and a ceiling of 365 days. Using 30.4 days per month, what window does this give? Your gap query shows a 95th percentile return gap of 190 days. What should you do about the candidate window?
Show answer
Days between sends are 30.4 / 2 = 15.2. Multiplying by 8 gives 121.6, which is between the floor and ceiling, so the window is 121 days after rounding down. The 95th percentile gap is 190 days, so a 121-day window would flag a noticeable share of people who later come back. Lengthen the window toward about 190 days, or keep 121 days and run a holdout test to measure how many flagged subscribers engage without prompting before deciding. Also remember the gap data covers only returners, so check the share of the list with no engagement at 90, 180, and 365 days too.
Exercise
You imported 40,000 addresses from an old platform and set every subscribed_at to today's date. Why is this a problem for the inactivity window, and what two fixes are available?
Show answer
The sunset logic starts the clock at subscribed_at when a subscriber has no engagement, so every imported address, including long-dead ones, gets a full new window before any action. Dead addresses keep receiving mail and may produce bounces or hit spam traps in the meantime. Fixes: restore the original opt-in dates from the old platform if you have them, or, if you don't, keep the import date but use a shorter first window or a separate re-engagement pass for the imported group.