CAC by channel is a simple division — ad spend ÷ new customers — wrapped in two hard problems: defining "new customer" in event data, and getting ad spend into the same query as GA4. Both are solvable in BigQuery without a CDP.
The definition used here: a new customer is a user_pseudo_id whose first purchase in the reporting period is treated as their acquisition, and the traffic source on that first purchase event is the acquisition channel. It's an approximation (see the caveats), but it's consistent, reproducible, and good enough to rank channels.
Step 1: New customers by channel
Find each user's first purchase timestamp in the period, join back to that exact event to read its traffic source, then aggregate:
WITH first_purchase AS ( SELECT user_pseudo_id , MIN ( event_timestamp ) AS first_purchase_timestamp FROM `project.analytics_123456789.events_*` WHERE _TABLE_SUFFIX BETWEEN '20260101' AND '20260131' AND event_name = 'purchase' GROUP BY user_pseudo_id ) , first_purchase_detail AS ( SELECT e .…