Skip to content

Instantly share code, notes, and snippets.

View AlexDinahl's full-sized avatar

Alex Dinahl AlexDinahl

  • Stuttgart
View GitHub Profile
@AlexDinahl
AlexDinahl / ga4_last_click_non_direct_traffic.sql
Last active February 23, 2024 14:44
Last-Click non direct model attribution by source, medium, campaign
/* Disclaimer: This is the modified code originally taken from this page:
https://tanelytics.com/ga4-bigquery-session-traffic_source/
So, all credits to Taneli Salonen
I just modified this code for my needs.
Sessions calculated as HyperLogLog: https://developers.google.com/analytics/blog/2022/hll#about_hll
So, approximate calculation that takes less recources