You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current logic in stg_ga4__events.sql detects Google click IDs (gclid) but does not account for Facebook click IDs (fbclid). To improve attribution tracking and ensure accurate categorization of traffic sources, we should update the logic to also detect fbclid in the page_location field.
Proposed Solution
Modify the CTE detect_gclid in the stg_ga4__events.sql file to check for both gclid and fbclid values. Rename the CTE to detect_click_ids to reflect the broader scope.
Updated Code Example:
detect_click_ids as (
select
* except (event_source, event_medium, event_campaign),
case
when (page_location like '%gclid%' and event_source is null) then "google"
when (page_location like '%fbclid%' and event_source is null) then "facebook"
else event_source
end as event_source,
case
when (page_location like '%gclid%' and event_medium is null) then "cpc"
when (page_location like '%fbclid%' and event_medium is null) then "paid_social"
else event_medium
end as event_medium,
case
when (page_location like '%gclid%' and event_campaign is null) then "(cpc)"
when (page_location like '%fbclid%' and event_campaign is null) then "(paid_social)"
else event_campaign
end as event_campaign
from include_event_key
)
The text was updated successfully, but these errors were encountered:
The current logic in stg_ga4__events.sql detects Google click IDs (gclid) but does not account for Facebook click IDs (fbclid). To improve attribution tracking and ensure accurate categorization of traffic sources, we should update the logic to also detect fbclid in the page_location field.
Proposed Solution
Modify the CTE detect_gclid in the stg_ga4__events.sql file to check for both gclid and fbclid values. Rename the CTE to detect_click_ids to reflect the broader scope.
Updated Code Example:
The text was updated successfully, but these errors were encountered: