Add conversion event; fix gclid conversions query (#4584)

* Add first_run conversion; use correct table names

* Ignore dryrun of query and view

* Remove HAVING clause; fix logical_or
This commit is contained in:
Frank Bertsch 2023-11-20 14:48:02 -05:00 коммит произвёл GitHub
Родитель c21cca68ab
Коммит dc3864fbc4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -179,6 +179,8 @@ dry_run:
- sql/moz-fx-data-shared-prod/firefox_desktop/quick_suggest/view.sql
- sql/moz-fx-data-shared-prod/stub_attribution_service_derived/dl_token_ga_attribution_lookup_v1/query.sql
- sql/moz-fx-data-shared-prod/stub_attribution_service/dl_token_ga_attribution_lookup/view.sql
- sql/moz-fx-data-shared-prod/mozilla_org_derived/gclid_conversions_v1/query.sql
- sql/moz-fx-data-shared-prod/mozilla_org/gclid_conversions/view.sql
# Materialized views
- sql/moz-fx-data-shared-prod/telemetry_derived/experiment_search_events_live_v1/init.sql
- sql/moz-fx-data-shared-prod/telemetry_derived/experiment_events_live_v1/init.sql

Просмотреть файл

@ -17,7 +17,7 @@ ga_ids_to_dl_token AS (
stub_session_id,
dl_token,
FROM
stub_attribution_service_derived.dl_ga_triplets_v1
stub_attribution_service_derived.dl_token_ga_attribution_lookup_v1
WHERE
ga_client_id IS NOT NULL
AND stub_session_id IS NOT NULL
@ -33,24 +33,28 @@ dl_token_to_telemetry_id AS (
telemetry_id_to_activity AS (
SELECT
client_id AS telemetry_client_id,
@activity_date AS activity_date,
submission_date AS activity_date,
search_count_all > 0 AS did_search,
ad_clicks_count_all > 0 AS did_click_ad,
TRUE AS was_active,
FROM
telemetry_derved.clients_daily_v6
telemetry_derived.clients_daily_v6
WHERE
submission_date = @activity_date
)
SELECT
activity_date,
gclid,
COALESCE(
LOGICAL_OR(was_active AND activity_date = first_seen_date),
FALSE
) AS did_firefox_first_run,
COALESCE(LOGICAL_OR(did_search), FALSE) AS did_search,
COALESCE(LOGICAL_OR(did_click_ad), FALSE) AS did_click_ad,
COALESCE(
LOGICAL_OR(was_active AND activity_date > first_seen_date),
FALSE
) AS did_returned_second_day
) AS did_returned_second_day,
FROM
gclids_to_ga_ids
INNER JOIN
@ -66,8 +70,5 @@ INNER JOIN
USING
(telemetry_client_id)
GROUP BY
activity_date,
gclid
HAVING
did_search
OR did_click_ad
OR did_returned_second_day

Просмотреть файл

@ -7,6 +7,10 @@ fields:
mode: NULLABLE
type: STRING
description: "A Google Click ID, which uniquely represent an ad impression for Google ads."
- name: did_firefox_first_run
mode: NULLABLE
type: BOOLEAN
description: "Whether the GA session associated with this GCLID resulted in a Firefox install which ran the first time on this day."
- name: did_search
mode: NULLABLE
type: BOOLEAN