Skip to content

Ad funnel from impressions to buyers by channel

MediumFull bankFunnelsJoinsRatios and percentages20 min2 hidden datasets

The task

Marketing wants one funnel per channel for the whole period: impressions, clicks, sign-ups and buyers.

  • impressions and clicks: the totals in ad_daily for the channel's campaigns
  • signups: users in signups whose campaign_id is a campaign of that channel (organic sign-ups with a NULL campaign_id belong to no channel)
  • buyers: those users who have at least one purchase later than their signed_up_at. A purchase at the same instant as the sign-up does not count. A user with five purchases is one buyer.
  • buyer_rate: buyers as a percentage of signups, rounded to 1 decimal place, or NULL if the channel has no sign-ups

Return one row for every channel in campaigns, even a channel with no delivery or sign-ups yet (zeros, and a NULL rate). The columns are channel, impressions, clicks, signups, buyers and buyer_rate. Sort by channel.

Expected output

channelimpressionsclickssignupsbuyersbuyer_rate
  • Sorted by channel ascending.
  • Numbers rounded to 1 decimal place.
  • Checked on the sample and on 2 hidden datasets. How grading works

Tables Marketing team · click a name to insert it

campaigns10 rows in the sample

One row per campaign. Key: campaign_id.

intUnique id.
textName.
textsearch, social, video, email or affiliate.
dateFirst day live.
dateLast day live. NULL if still running.
numeric(10,2)Budget per day, USD.
ad_daily969 rows in the sample

One row per campaign per day it served ads. Days with no delivery have no row. Key: campaign_id, day.

intThe campaign.
dateThe day.
intTimes an ad was shown.
intClicks.
numeric(10,2)Money spent, USD.
signups2,108 rows in the sample

One row per new user. campaign_id is the campaign credited with the sign-up. Key: user_id.

intUnique id.
timestampWhen they signed up (UTC).
intCredited campaign. NULL for organic sign-ups.
textTwo-letter country code.
purchases2,294 rows in the sample

One row per paid order by a user. Key: purchase_id.

intUnique id.
intBuyer.
timestampWhen (UTC).
numeric(10,2)Order value, USD.

Related questions

Loading the editor and PostgreSQL