Skip to content

Commit

Permalink
Include device dimension when calculating custom conversions
Browse files Browse the repository at this point in the history
Change-Id: I3ceda37773ac640c5460d70a85aef7abb5544e44
  • Loading branch information
AVMarkin committed Nov 27, 2023
1 parent b95024e commit 3945fda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/bq_queries/ad_video_performance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ WITH
SELECT
date,
ad_id,
device,
{% for custom_conversion in custom_conversions %}
{% for conversion_alias, conversion_name in custom_conversion.items() %}
SUM(IF(conversion_name IN ('{{conversion_name}}'), all_conversions, 0)) AS conversions_{{conversion_alias}},
{% endfor %}
{% endfor %}
FROM `{bq_dataset}.conversion_split` AS AP
GROUP BY 1,2
GROUP BY 1, 2, 3
)
SELECT
PARSE_DATE("%Y-%m-%d", AP.date) AS day,
Expand Down Expand Up @@ -177,6 +178,7 @@ LEFT JOIN `{bq_dataset}.video_headlines_call_to_actions` AS V
LEFT JOIN CustomConvSplit AS CCS
ON AP.ad_id = CCS.ad_id
AND AP.date = CCS.date
AND AP.device = CCS.device
LEFT JOIN MappingTable AS M
ON AP.ad_group_id = M.ad_group_id
LEFT JOIN `{bq_dataset}.asset_mapping` AS Assets
Expand Down
1 change: 1 addition & 0 deletions app/google_ads_queries/performance/conversion_split.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SELECT
segments.date AS date,
ad_group.id AS ad_group_id,
ad_group_ad.ad.id AS ad_id,
segments.device AS device,
segments.conversion_action AS conversion_action,
segments.conversion_action_name AS conversion_name,
metrics.conversions AS conversions,
Expand Down

0 comments on commit 3945fda

Please sign in to comment.