Marketing Analytics Path · Mission 16 of 25Hard

Is our email actually working?

Use date arithmetic to find purchases within 7 days of campaign_id=1 sends

Back to Marketing Analytics

The Brief

Priya PatelAnalytics Leadmarketing-analytics

I'm trying to figure out email attribution. For each email campaign, how many customers who received the email actually made a purchase afterward? Need `campaign_name`, customers emailed, and customers who purchased. Watch out for the date ordering — a purchase only counts if it happened *after* the email was sent.

You'll practice

Date mathAttributionINTERVAL

Tables available

fact_purchasesfact_sendsfact_sessions

Hints (4)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

JOIN `fact_sends` to `fact_purchases` on `customer_id` — you're looking for customers who purchased after receiving an email from campaign 1

Hint 2

Both date columns (`sent_at`, `purchase_date`) are text. Cast them: `fp.purchase_date::date > fs.sent_at::date`

Hint 3

Add a 7-day window: `AND fp.purchase_date::date <= fs.sent_at::date + INTERVAL '7 days'`

Hint 4

Filter to campaign 1: `WHERE fs.campaign_id = 1`. Count the matches with `SELECT COUNT(*)`