DataLane

26. First-touch traffic source

Asked in screens shaped like: Airbnb, Shopify, Meta

Growth wants each customer’s first event source. First means earliest occurred_at; tie-break on event_id. Source lives in the JSON payload. Return customer_id and source, smallest customer_id first.

Requirements

  • Columns: customer_id, source
  • One row per customer
  • source is json_extract(payload, $.source) on the first event
  • Order by customer_id

Expected output

customer_id, source

Row order is graded, so ORDER BY matters here.

SQL editor

Loading SQL engine…

Ctrl/Cmd + Enter submits

Run your query to see the result set.

Pro problem

Hard problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close