Query of the Week · Library

Cart abandoners

← Back to overview

1 · Business question

Added an advertised product to the cart but did not buy: the group closest to purchase.

2 · Query (SQL)

WITH carted AS (
  SELECT user_id
  FROM amazon_attributed_events_by_conversion_time_for_audiences
  WHERE add_to_cart > 0
  GROUP BY user_id
),
purchased AS (
  SELECT user_id
  FROM amazon_attributed_events_by_conversion_time_for_audiences
  WHERE purchases > 0
  GROUP BY user_id
)
SELECT c.user_id
FROM carted c
LEFT JOIN purchased p ON c.user_id = p.user_id
WHERE p.user_id IS NULL

3 · Interpretation

DSP targeting or Sponsored Display targeting; in SP/SB as a bid boost.

/en/query-of-the-week/cart-abandoners/