Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create serp_events_clients_daily table and view #6339

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE OR REPLACE VIEW
`moz-fx-data-shared-prod.search.serp_events_clients_daily`
AS
SELECT
*
FROM
`moz-fx-data-shared-prod.search_derived.serp_events_clients_daily_v1`
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
friendly_name: SERP Events Clients Daily
description: |-
Aggregation of the desktop SERP Events data to the client-daily level.
owners:
- mozilla/revenue_forecasting_data_reviewers
labels:
incremental: true
schedule: daily
dag: bqetl_search_dashboard
scheduling:
dag_name: bqetl_search_dashboard
bigquery:
time_partitioning:
type: day
field: submission_date
require_partition_filter: true
expiration_days: null
range_partitioning: null
clustering: null
references: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
SELECT
submission_date,
glean_client_id,
legacy_telemetry_client_id,
profile_group_id,
`moz-fx-data-shared-prod`.udf.normalize_search_engine(search_engine) AS partner,
'desktop' AS device,
normalized_country_code,
normalized_channel,
os,
browser_version_info.major_version AS browser_major_version,
browser_version_info.minor_version AS browser_minor_version,
ANY_VALUE(experiments) AS experiments,
LOGICAL_OR(ad_blocker_inferred) AS ad_blocker_inferred,
COUNT(
DISTINCT IF(
REGEXP_CONTAINS(sap_source, 'urlbar')
OR sap_source IN ('searchbar', 'contextmenu', 'webextension', 'system'),
impression_id,
NULL
)
) AS sap,
COUNTIF(is_tagged) AS tagged_sap,
COUNTIF(is_tagged AND REGEXP_CONTAINS(sap_source, 'follow_on')) AS tagged_follow_on,
SUM(num_ad_clicks) AS ad_click,
COUNTIF(num_ads_visible > 0) AS search_with_ads,
COUNTIF(NOT is_tagged) AS organic,
SUM(IF(NOT is_tagged, num_ad_clicks, 0)) AS ad_click_organic,
COUNTIF(num_ads_visible > 0 AND NOT is_tagged) AS search_with_ads_organic,
-- serp_events does not have distribution ID or partner codes to calculate monetizable SAP
COUNTIF(ad_blocker_inferred) AS sap_with_ad_blocker_inferred,
SUM(num_ads_visible) AS num_ads_visible,
SUM(num_ads_blocked) AS num_ads_blocked,
SUM(num_ads_notshowing) AS num_ads_notshowing,
COUNTIF(abandon_reason IS NOT NULL) AS num_abandoned_serp
FROM
`moz-fx-data-shared-prod.firefox_desktop.serp_events`
WHERE
submission_date = DATE_SUB(@submission_date, INTERVAL 1 DAY)
GROUP BY
submission_date,
glean_client_id,
legacy_telemetry_client_id,
profile_group_id,
partner,
device,
normalized_country_code,
normalized_channel,
os,
browser_major_version,
browser_minor_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
fields:
- mode: NULLABLE
name: submission_date
type: DATE
- mode: NULLABLE
name: glean_client_id
type: STRING
- mode: NULLABLE
name: legacy_telemetry_client_id
type: STRING
- mode: NULLABLE
name: profile_group_id
type: STRING
- mode: NULLABLE
name: partner
type: STRING
- mode: NULLABLE
name: device
type: STRING
- mode: NULLABLE
name: normalized_country_code
type: STRING
- mode: NULLABLE
name: normalized_channel
type: STRING
- mode: NULLABLE
name: os
type: STRING
- mode: NULLABLE
name: browser_major_version
type: NUMERIC
- mode: NULLABLE
name: browser_minor_version
type: NUMERIC
- fields:
- mode: NULLABLE
name: key
type: STRING
- fields:
- mode: NULLABLE
name: branch
type: STRING
- fields:
- mode: NULLABLE
name: type
type: STRING
- mode: NULLABLE
name: enrollment_id
type: STRING
mode: NULLABLE
name: extra
type: RECORD
mode: NULLABLE
name: value
type: RECORD
mode: REPEATED
name: experiments
type: RECORD
- mode: NULLABLE
name: ad_blocker_inferred
type: BOOLEAN
- mode: NULLABLE
name: sap
type: INTEGER
- mode: NULLABLE
name: tagged_sap
type: INTEGER
- mode: NULLABLE
name: tagged_follow_on
type: INTEGER
- mode: NULLABLE
name: ad_click
type: INTEGER
- mode: NULLABLE
name: search_with_ads
type: INTEGER
- mode: NULLABLE
name: organic
type: INTEGER
- mode: NULLABLE
name: ad_click_organic
type: INTEGER
- mode: NULLABLE
name: search_with_ads_organic
type: INTEGER
- mode: NULLABLE
name: sap_with_ad_blocker_inferred
type: INTEGER
- mode: NULLABLE
name: num_ads_visible
type: INTEGER
- mode: NULLABLE
name: num_ads_blocked
type: INTEGER
- mode: NULLABLE
name: num_ads_notshowing
type: INTEGER
- mode: NULLABLE
name: num_abandoned_serp
type: INTEGER