Skip to content

Commit 83e2627

Browse files
committed
create serp_events_clients_daily table and view
1 parent 221cd9b commit 83e2627

File tree

4 files changed

+182
-0
lines changed

4 files changed

+182
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE OR REPLACE VIEW
2+
`moz-fx-data-shared-prod.search.serp_events_clients_daily`
3+
AS
4+
SELECT
5+
*
6+
FROM
7+
`moz-fx-data-shared-prod.search_derived.serp_events_clients_daily_v1`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
friendly_name: SERP Events Clients Daily
2+
description: |-
3+
Aggregation of the desktop SERP Events data to the client-daily level.
4+
owners:
5+
- mozilla/revenue_forecasting_data_reviewers
6+
labels:
7+
incremental: true
8+
schedule: daily
9+
dag: bqetl_search_dashboard
10+
scheduling:
11+
dag_name: bqetl_search_dashboard
12+
bigquery:
13+
time_partitioning:
14+
type: day
15+
field: submission_date
16+
require_partition_filter: true
17+
expiration_days: null
18+
range_partitioning: null
19+
clustering: null
20+
references: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SELECT
2+
submission_date,
3+
glean_client_id,
4+
legacy_telemetry_client_id,
5+
profile_group_id,
6+
`moz-fx-data-shared-prod`.udf.normalize_search_engine(search_engine) AS partner,
7+
'desktop' AS device,
8+
normalized_country_code,
9+
normalized_channel,
10+
os,
11+
browser_version_info.major_version AS browser_major_version,
12+
browser_version_info.minor_version AS browser_minor_version,
13+
ANY_VALUE(experiments) AS experiments,
14+
LOGICAL_OR(ad_blocker_inferred) AS ad_blocker_inferred,
15+
COUNT(
16+
DISTINCT IF(
17+
REGEXP_CONTAINS(sap_source, 'urlbar')
18+
OR sap_source IN ('searchbar', 'contextmenu', 'webextension', 'system'),
19+
impression_id,
20+
NULL
21+
)
22+
) AS sap,
23+
COUNTIF(is_tagged) AS tagged_sap,
24+
COUNTIF(is_tagged AND REGEXP_CONTAINS(sap_source, 'follow_on')) AS tagged_follow_on,
25+
SUM(num_ad_clicks) AS ad_click,
26+
COUNTIF(num_ads_visible > 0) AS search_with_ads,
27+
COUNTIF(NOT is_tagged) AS organic,
28+
SUM(IF(NOT is_tagged, num_ad_clicks, 0)) AS ad_click_organic,
29+
COUNTIF(num_ads_visible > 0 AND NOT is_tagged) AS search_with_ads_organic,
30+
-- serp_events does not have distribution ID or partner codes to calculate monetizable SAP
31+
COUNTIF(ad_blocker_inferred) AS sap_with_ad_blocker_inferred,
32+
SUM(num_ads_visible) AS num_ads_visible,
33+
SUM(num_ads_blocked) AS num_ads_blocked,
34+
SUM(num_ads_notshowing) AS num_ads_notshowing,
35+
COUNTIF(abandon_reason IS NOT NULL) AS num_abandoned_serp
36+
FROM
37+
`moz-fx-data-shared-prod.firefox_desktop.serp_events`
38+
WHERE
39+
{% if is_init() %}
40+
submission_date >= '2023-07-14'
41+
{% else %}
42+
submission_date = @submission_date
43+
{% endif %}
44+
GROUP BY
45+
submission_date,
46+
glean_client_id,
47+
legacy_telemetry_client_id,
48+
profile_group_id,
49+
partner,
50+
device,
51+
normalized_country_code,
52+
normalized_channel,
53+
os,
54+
browser_major_version,
55+
browser_minor_version
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
fields:
2+
- mode: NULLABLE
3+
name: submission_date
4+
type: DATE
5+
- mode: NULLABLE
6+
name: glean_client_id
7+
type: STRING
8+
- mode: NULLABLE
9+
name: legacy_telemetry_client_id
10+
type: STRING
11+
- mode: NULLABLE
12+
name: profile_group_id
13+
type: STRING
14+
- mode: NULLABLE
15+
name: partner
16+
type: STRING
17+
- mode: NULLABLE
18+
name: device
19+
type: STRING
20+
- mode: NULLABLE
21+
name: normalized_country_code
22+
type: STRING
23+
- mode: NULLABLE
24+
name: normalized_channel
25+
type: STRING
26+
- mode: NULLABLE
27+
name: os
28+
type: STRING
29+
- mode: NULLABLE
30+
name: browser_major_version
31+
type: NUMERIC
32+
- mode: NULLABLE
33+
name: browser_minor_version
34+
type: NUMERIC
35+
- fields:
36+
- mode: NULLABLE
37+
name: key
38+
type: STRING
39+
- fields:
40+
- mode: NULLABLE
41+
name: branch
42+
type: STRING
43+
- fields:
44+
- mode: NULLABLE
45+
name: type
46+
type: STRING
47+
- mode: NULLABLE
48+
name: enrollment_id
49+
type: STRING
50+
mode: NULLABLE
51+
name: extra
52+
type: RECORD
53+
mode: NULLABLE
54+
name: value
55+
type: RECORD
56+
mode: REPEATED
57+
name: experiments
58+
type: RECORD
59+
- mode: NULLABLE
60+
name: ad_blocker_inferred
61+
type: BOOLEAN
62+
- mode: NULLABLE
63+
name: sap
64+
type: INTEGER
65+
- mode: NULLABLE
66+
name: tagged_sap
67+
type: INTEGER
68+
- mode: NULLABLE
69+
name: tagged_follow_on
70+
type: INTEGER
71+
- mode: NULLABLE
72+
name: ad_click
73+
type: INTEGER
74+
- mode: NULLABLE
75+
name: search_with_ads
76+
type: INTEGER
77+
- mode: NULLABLE
78+
name: organic
79+
type: INTEGER
80+
- mode: NULLABLE
81+
name: ad_click_organic
82+
type: INTEGER
83+
- mode: NULLABLE
84+
name: search_with_ads_organic
85+
type: INTEGER
86+
- mode: NULLABLE
87+
name: sap_with_ad_blocker_inferred
88+
type: INTEGER
89+
- mode: NULLABLE
90+
name: num_ads_visible
91+
type: INTEGER
92+
- mode: NULLABLE
93+
name: num_ads_blocked
94+
type: INTEGER
95+
- mode: NULLABLE
96+
name: num_ads_notshowing
97+
type: INTEGER
98+
- mode: NULLABLE
99+
name: num_abandoned_serp
100+
type: INTEGER

0 commit comments

Comments
 (0)