From 0f0ab635b1e2511dff344576427e14f73d35d392 Mon Sep 17 00:00:00 2001 From: Marlene Hirose <92952117+Marlene-M-Hirose@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:27:13 -0700 Subject: [PATCH] add udf for paid vs organic attribution (#6177) * add udf for paid vs organic attribution * fix formatting of query file --- .../desktop_new_profiles_aggregates_v1/query.sql | 3 +++ .../desktop_new_profiles_aggregates_v1/schema.yaml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/query.sql index a530954efd..2b4860c098 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/query.sql @@ -10,6 +10,7 @@ WITH clients_first_seen AS ( attribution_dlsource, attribution_ua, (attribution_medium IS NOT NULL OR attribution_source IS NOT NULL) AS attributed, + `moz-fx-data-shared-prod.udf.organic_vs_paid_desktop`(attribution_medium) AS paid_vs_organic, city, country, distribution_id, @@ -47,6 +48,7 @@ SELECT cfs.attribution_dlsource, cfs.attribution_ua, cfs.attributed, + cfs.paid_vs_organic, cfs.city, cfs.country, cfs.distribution_id, @@ -77,6 +79,7 @@ GROUP BY cfs.attribution_dlsource, cfs.attribution_ua, cfs.attributed, + cfs.paid_vs_organic, cfs.city, cfs.country, cfs.distribution_id, diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/schema.yaml b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/schema.yaml index 5e1c8c9349..f277a27d14 100644 --- a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/schema.yaml +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_new_profiles_aggregates_v1/schema.yaml @@ -34,6 +34,10 @@ fields: name: attributed type: BOOLEAN mode: NULLABLE +- description: Is desktop client attribution organic or paid + name: paid_vs_organic + type: STRING + mode: NULLABLE - description: City retrieved as a result of a geographic lookup based on the client's IP address. name: city type: STRING