-
Notifications
You must be signed in to change notification settings - Fork 111
Create serp_events_clients_daily table and view #6339
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
Open
m-d-bowerman
wants to merge
5
commits into
main
Choose a base branch
from
serp_events_clients_daily
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
83e2627
create serp_events_clients_daily table and view
m-d-bowerman 730e05d
submission date filter to account for lag
m-d-bowerman b019c56
remove init templating
m-d-bowerman 0487b88
query format
m-d-bowerman 2833d64
Merge branch 'main' into serp_events_clients_daily
m-d-bowerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/search/serp_events_clients_daily/view.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
20 changes: 20 additions & 0 deletions
20
sql/moz-fx-data-shared-prod/search_derived/serp_events_clients_daily_v1/metadata.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} |
55 changes: 55 additions & 0 deletions
55
sql/moz-fx-data-shared-prod/search_derived/serp_events_clients_daily_v1/query.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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 | ||
{% if is_init() %} | ||
submission_date >= '2023-07-14' | ||
{% else %} | ||
submission_date = @submission_date | ||
{% endif %} | ||
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 |
100 changes: 100 additions & 0 deletions
100
sql/moz-fx-data-shared-prod/search_derived/serp_events_clients_daily_v1/schema.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please implement this without the templating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So create the table and then backfill instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with the template removed