Skip to content

Purchase funnel by experiment variant

HardFull bankFunnelsJoinsRatios and percentages28 min2 hidden datasets

The task

The team tested a new onboarding flow (new_onboarding in experiment_assignments). Compare the control and treatment groups on a purchase funnel that only looks at what users did after they were assigned.

For each user in the experiment, use their assigned_at. Events at or before assigned_at are ignored, so an event at exactly the same second as the assignment does not count. The steps must happen in order:

  • assigned: users assigned to the variant
  • viewed: users with a view_item event after assigned_at
  • added_to_cart: users with an add_to_cart event after their first qualifying view_item
  • purchased: users with a purchase event after their first qualifying add_to_cart

Return one row per variant with variant, assigned, viewed, added_to_cart, purchased, and purchase_rate: purchased as a percentage of assigned, rounded to 1 decimal place. Sort by variant.

Expected output

variantassignedviewedadded_to_cartpurchasedpurchase_rate
  • Sorted by variant 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.

intUnique id.
timestampSign-up time (UTC).
textTwo-letter country code.
textios, android or web.
textorganic, paid, referral or partner. NULL when unknown.
events7,616 rows in the sample

One row per tracked event. Key: event_id.

bigintUnique id.
intWho fired it.
textapp_open, search, view_item, add_to_cart, begin_checkout, purchase or share.
timestampWhen (UTC).
textSession 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.

intThe user.
textnew_onboarding or one_tap_checkout.
textcontrol or treatment.
timestampWhen the user was assigned (UTC).

Related questions

Loading the editor and PostgreSQL