Team & campaigns

Seasonal promotion with a holdout group

A year-end sale for active free users, by push and email in each user’s daytime, with one user in ten held back as a control group to measure what the campaign added.

EmailPushtrigger.datetimeWindowcohortsegmentsperformedgoalreentry: never
import { and, eq, performed, trigger, workflow } from 'sendwend';
import { e, u } from './contract';
import { activated } from './segments';
import { email, push } from './templates';

/**
 * Who the sale is for: active free users, asked when the send starts.
 */
const audience = and(eq(u.subscription_plan, 'free'), activated);

/**
 * Seasonal promotion with a holdout: a year-end sale for active free
 * users, with one user in ten held back and sent nothing. Purchases
 * within two weeks are the goal; comparing the promo arm's conversion
 * rate with the holdout's shows what the campaign added over the
 * purchases that would have happened anyway.
 *
 * `cohort` splits users at random by weight; an arm with no flow sends
 * nothing and simply continues. The `key` makes the bucketing hash
 * `userId:key`, so editing the workflow later does not reshuffle who is
 * in which arm.
 */
export const seasonalPromotionHoldout = workflow({
  id: 'seasonal_promotion_holdout',
  name: 'Seasonal promotion with holdout',
  trigger: trigger.date('2026-12-26 07:00:00', { filter: audience }),
  reentry: { mode: 'never' },
  goal: { condition: performed(e.purchase), within: '14 days' },
}).cohort(
  {
    holdout: { weight: 10 },
    promo: {
      weight: 90,
      flow: (w) =>
        w
          .timeWindow({ between: ['09:00', '21:00'] })
          .push(push.yearEndSale, { coupon: 'YEAREND25' })
          .email(email.yearEndSale, {
            name: u.name,
            coupon: 'YEAREND25',
          }),
    },
  },
  { key: 'year_end_2026' }
);
Compiled canvasDrag to pan

When to use it

For any one-off campaign you want to measure honestly. Some people buy during a sale who would have bought anyway; a holdout group that receives nothing shows the difference the campaign made.

How it works

  1. 1A date trigger fires once on December 26 at 07:00 UTC, for every active user on the free plan.
  2. 2cohort sends 90% of users to the promo arm and 10% to holdout, at random.
  3. 3The promo arm holds until daytime, then sends a push and an email with the coupon.
  4. 4The holdout arm sends nothing.
  5. 5A purchase within 14 days is the goal, for both arms alike.

Why it's built this way

An empty arm is the control

An arm with no flow sends nothing and continues. Its users still carry the workflow’s goal, so their purchases are counted in the same window as the promo arm’s.

A stable key

With key: 'year_end_2026', bucketing hashes the user id with the key, so an edit to the workflow after launch does not move users between arms.

The audience is asked at send time

A date trigger’s filter is evaluated when the send starts, so a user who upgraded the day before is not offered a discount on what they already bought.

Make it yours

  • Set the date and the coupon to your own campaign.
  • Size the holdout to your audience: a larger one gives a clearer comparison but sends the offer to fewer people.
  • Add a third arm to test two offers against each other and the holdout.

What to measure

Conversion lift: the promo arm’s purchase rate minus the holdout’s, within 14 days.

Also see Weekly digest email workflow.