Skip to content

Commit

Permalink
Add 1 more column to downloads_v2 (#5861)
Browse files Browse the repository at this point in the history
* Add new column 'campaign_from_event_params' to schema.yaml

* Updated query
  • Loading branch information
kwindau committed Jun 27, 2024
1 parent b8bee8b commit 3c393f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -103,7 +114,8 @@ WITH staging AS (
medium,
campaign,
ad_content,
browser
browser,
campaign_from_event_params
)
SELECT
`date`,
Expand All @@ -121,6 +133,7 @@ SELECT
medium,
campaign,
ad_content,
campaign_from_event_params,
browser,
download_events,
download_events AS downloads,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c393f2

Please sign in to comment.