Week-two retention by acquisition channel
The task
Marketing wants to compare how well each acquisition channel keeps its users in their second week.
Rules:
- The sign-up date is day 0 (the UTC date of
users.signed_up_at). A user is retained if they fired at least one event on a date from day 7 to day 13, both included. - Group users by
users.acquisition_channel. Users whose channel is NULL form their own group, labelledunknown. - Count users, not events. Users who never fired an event stay in the denominator.
Return channel, users, retained_users and retention_pct (retained users as a percentage of the channel's users, rounded to 1 decimal place). Sort by retention_pct descending, then channel ascending.
Expected output
channelusersretained_usersretention_pct- Sorted by retention_pct descending, then channel ascending.
- Numbers rounded to 1 decimal place.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Mobile shopping app · click a name to insert it
users360 rows in the sample
One row per user. Key: user_id.
| int | Unique id. | |
| timestamp | Sign-up time (UTC). | |
| text | Two-letter country code. | |
| text | ios, android or web. | |
| text | organic, paid, referral or partner. NULL when unknown. |
events7,616 rows in the sample
One row per tracked event. Key: event_id.
| bigint | Unique id. | |
| int | Who fired it. | |
| text | app_open, search, view_item, add_to_cart, begin_checkout, purchase or share. | |
| timestamp | When (UTC). | |
| text | Session the event belongs to. NULL for a few events sent from the background. | |
| numeric(10,2) | Order value for purchase events, NULL otherwise. |
experiment_assignments349 rows in the sample
Which variant each user saw in each experiment. Key: user_id, experiment.
| int | The user. | |
| text | new_onboarding or one_tap_checkout. | |
| text | control or treatment. | |
| timestamp | When the user was assigned (UTC). |
Related questions
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL