Google Analytics 4 contains a known traffic source misattribution bug in the raw BigQuery export.
I fixed it with a few lines of code:
I fixed it with a few lines of code:
Comments
This should be impossible, as the GCLID would only populate on an ad (and therefore should be cpc/paid traffic source medium)
CASE
WHEN REGEXP_CONTAINS(page_location, r'gclid=.+') AND traffic_source_source = 'google' THEN 'cpc'
/* Known GA4 misattribution bug */
ELSE traffic_source_medium
END
AS traffic_source_medium