Skip to content

Commit 0fd1ea6

Browse files
authored
Add custom enrollment query for the Taskbar Tabs V2 experiment (#1270)
1 parent 1c565b3 commit 0fd1ea6

File tree

1 file changed

+109
-9
lines changed

1 file changed

+109
-9
lines changed

jetstream/whats-new-toast-notification-taskbar-tabs-release-v2.toml

Lines changed: 109 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,114 @@
11
[experiment]
2+
analysis_unit = "client_id"
23

3-
segments = [
4-
"activity_infrequent_or_casual",
5-
"last_dau_2_to_4_weeks_ago",
6-
"last_dau_5_to_8_weeks_ago",
7-
"last_dau_more_than_8_weeks_ago",
8-
"last_dau_more_than_4_weeks_ago",
9-
"never_user",
10-
"new_unique_profiles",
11-
]
4+
enrollment_query = """
5+
SELECT * FROM
6+
(
7+
8+
-- Early data shows that the 'experiments' annotation is more robust than either
9+
-- the 'enrollment' or the 'exposure' event in background update telemetry, see
10+
-- [Bug 1809275](https://bugzilla.mozilla.org/show_bug.cgi?id=1809275). That
11+
-- is, some legacy client IDs do not report 'enrollment' or 'exposure' events,
12+
-- but do appear in `experiments` annotations. Therefore, we use 'enrollment'
13+
-- events as our primary enrollment indicator but also look for an 'experiments'
14+
-- annotation.
15+
--
16+
-- But, some legacy client IDs that click the notification do not correspond to
17+
-- default profile IDs reported by background update pings: these may be due to
18+
-- multiple profiles, multiple OS-level users, or telemetry errors. Some amount
19+
-- of such client IDs are anticipated. We use a browsing telemetry query for
20+
-- these legacy client IDs.
21+
--
22+
-- Finally, we take the earliest of these two enrollment signals to determine
23+
-- enrollment date. This will always be before we witness a notification click,
24+
-- so we should not have a legacy client ID that does not have at least one
25+
-- analysis window containing a notification click.
26+
27+
(
28+
SELECT
29+
JSON_VALUE(metrics, '$.uuid.background_update_client_id') AS analysis_id,
30+
JSON_VALUE(event_extra, '$.branch') AS branch,
31+
MIN(DATE(events.submission_timestamp)) AS enrollment_date,
32+
COUNT(events.submission_timestamp) AS num_enrollment_events
33+
-- Query from events_stream because it's much more efficient than unnesting events.
34+
FROM `moz-fx-data-shared-prod.firefox_desktop_background_update.events_stream` events
35+
WHERE
36+
DATE(submission_timestamp) BETWEEN
37+
'{{experiment.start_date_str}}' AND
38+
-- Here we can restrict to the last enrollment date range.
39+
'{{experiment.last_enrollment_date_str}}'
40+
AND event_category = 'nimbus_events'
41+
AND event_name = 'enrollment'
42+
-- The background update experiment slug is exact.
43+
AND JSON_VALUE(event_extra, '$.experiment') = '{{experiment.normandy_slug}}'
44+
-- This should never happen, but belt-and-braces.
45+
AND JSON_VALUE(metrics, '$.uuid.background_update_client_id') IS NOT NULL
46+
GROUP BY analysis_id, branch
47+
)
48+
49+
UNION ALL
50+
51+
(
52+
SELECT
53+
m.metrics.uuid.background_update_client_id AS analysis_id,
54+
experiment.value.branch AS branch,
55+
MIN(DATE(submission_timestamp)) AS enrollment_date,
56+
-- These aren't discrete events, it makes no sense to count them.
57+
1 AS num_enrollment_events
58+
-- We need to query from the Glean `background_update` table because pre-[Bug
59+
-- 1794053](https://bugzilla.mozilla.org/show_bug.cgi?id=1794053) (scheduled for
60+
-- Firefox 109) we don't have the legacy client ID in
61+
-- `mozdata.firefox_desktop_background_update.events`.
62+
FROM `mozdata.firefox_desktop_background_update.background_update` AS m
63+
CROSS JOIN
64+
UNNEST(ping_info.experiments) AS experiment
65+
WHERE
66+
-- Background update telemetry can be delayed, so we accept enrollment
67+
-- _submission_ dates during the elongated enrollment period. It's safer to
68+
-- compare submission dates generated server-side than internal ping dates
69+
-- generated client-side.
70+
DATE(submission_timestamp) BETWEEN
71+
'{{experiment.start_date_str}}' AND
72+
'{{experiment.last_enrollment_date_str}}'
73+
-- The background update experiment slug is exact.
74+
AND experiment.key = '{{experiment.normandy_slug}}'
75+
GROUP BY analysis_id, branch
76+
)
77+
78+
UNION ALL
79+
80+
(
81+
SELECT
82+
client_id AS analysis_id,
83+
-- Post [Bug 1804988](https://bugzilla.mozilla.org/show_bug.cgi?id=1804988),
84+
-- this name looks like 'slug:branch'.
85+
SPLIT(mozfun.map.get_key(event_map_values, 'name'), ':')[SAFE_OFFSET(1)] AS branch,
86+
MIN(submission_date) AS enrollment_date,
87+
COUNT(submission_date) AS num_enrollment_events
88+
FROM
89+
`mozdata.telemetry.events`
90+
WHERE
91+
-- Browsing telemetry should not be delayed, but notification clicks need
92+
-- not coincide with actual enrollment.
93+
submission_date BETWEEN
94+
'{{experiment.start_date_str}}' AND
95+
'{{experiment.last_enrollment_date_str}}'
96+
AND event_category = 'browser.launched_to_handle'
97+
AND event_method = 'system_notification'
98+
AND event_object = 'toast'
99+
-- Post [Bug 1804988](https://bugzilla.mozilla.org/show_bug.cgi?id=1804988),
100+
-- this name looks like 'slug:branch'.
101+
AND STARTS_WITH(mozfun.map.get_key(event_map_values, 'name'), '{{experiment.normandy_slug}}:')
102+
GROUP BY
103+
analysis_id, branch
104+
)
105+
106+
)
107+
QUALIFY ROW_NUMBER() OVER (PARTITION BY analysis_id ORDER BY enrollment_date ASC) = 1
108+
"""
109+
110+
#segment information:https://docs.telemetry.mozilla.org/concepts/segments.html
111+
segments = ["new_or_resurrected_v3", "activity_infrequent_or_casual"]
12112

13113
[metrics]
14114

0 commit comments

Comments
 (0)