The Shopper Path to Payment
The Shopper Path to Payment
You analyze a marketplace for independent local brands. Before a major acquisition campaign, the growth team wants a basic multi-step funnel by traffic source: product view, cart open, checkout start, and payment.
For each shopper, take the earliest non-null timestamp for each of these event types: product_viewed, cart_opened, checkout_started, and order_paid. A shopper reaches a later stage only when those first-achievement timestamps are in non-decreasing order. Adjacent stages may share the same timestamp. For example, when the earliest cart open happened before the earliest product view, the shopper does not reach the cart stage even if another cart event occurred later.
Include every source found in marketplace_shoppers, including sources with no product views. Display a NULL traffic_source as unknown.
Return columns:
- source — traffic source, text.
- viewed_users — shoppers who reached the view stage, integer.
- cart_users — shoppers who reached the cart stage after the view under the rules above, integer.
- checkout_users — shoppers who reached checkout after the cart stage, integer.
- paid_users — shoppers who reached payment after checkout, integer.
- view_to_paid_pct — paid shoppers as a percentage of viewed shoppers, numeric, rounded to 2 decimal places. Return 0.00 when there are no viewed shoppers.
Sort by source ascending. Ignore events whose event_time is NULL. Repeated events of the same type must not inflate counts.
Exemplo de resposta esperada
É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.
| source | viewed_users | cart_users | checkout_users | paid_users | view_to_paid_pct |
|---|---|---|---|---|---|
| affiliate | 2 | 1 | 1 | 0 | 0 |
| direct | 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 0 |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar