diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/query.sql b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/query.sql index da2670be92..c3578c34d7 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/query.sql +++ b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/query.sql @@ -16,6 +16,7 @@ WITH staging AS ( campaign, ad_content, browser, + campaign_from_event_params, --note: the 2 columns are the same because in GA4, there is no logic saying you can only count 1 download per session, unlike GA3 COUNTIF( --prior to and including 2/16/24 @@ -58,6 +59,16 @@ WITH staging AS ( collected_traffic_source.manual_content AS ad_content, device.web_info.browser AS browser, event_name, + ( + SELECT + `value` + FROM + UNNEST(event_params) + WHERE + key = 'campaign' + LIMIT + 1 + ).string_value AS campaign_from_event_params, ( SELECT `value` @@ -103,7 +114,8 @@ WITH staging AS ( medium, campaign, ad_content, - browser + browser, + campaign_from_event_params ) SELECT `date`, @@ -121,6 +133,7 @@ SELECT medium, campaign, ad_content, + campaign_from_event_params, browser, download_events, download_events AS downloads, diff --git a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/schema.yaml b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/schema.yaml index ffaf0fac26..96a2414b1e 100644 --- a/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/schema.yaml +++ b/sql/moz-fx-data-marketing-prod/ga_derived/www_site_downloads_v2/schema.yaml @@ -63,6 +63,10 @@ fields: name: browser type: STRING description: Browser +- mode: NULLABLE + name: campaign_from_event_params + type: STRING + description: Campaign - Parsed from nested event_params key = campaign - mode: NULLABLE name: download_events type: INT64