Browse-only sessions by platform
The task
The product team wants to know on which platforms people browse without adding anything to the cart.
A session is identified by the pair (user_id, session_id): two users may reuse the same session_id text, and those are different sessions. Events with a NULL session_id belong to no session and are ignored.
A session is "browse-only" when it has at least one view_item event and no add_to_cart event. Count the browse-only sessions for each platform of the user (from users).
Return platform and browse_only_sessions, one row per platform that has at least one browse-only session, sorted by platform.
Expected output
platformbrowse_only_sessions- Sorted by platform ascending.
- 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