Skip to content

Commit 6dda57a

Browse files
authored
feat(DENG-9432): Create firefox_desktop.clients_first_seen_28_days_later (#8487)
* feat(DENG-9432): Create firefox_desktop.clients_first_seen_28_days_later * feat(DENG-9432): Add client_level table type label * feat(DENG-9432): Add new first seen table to retention exclusion list * feat(DENG-9432): Add days_active_bits column
1 parent 559d647 commit 6dda57a

File tree

6 files changed

+364
-0
lines changed

6 files changed

+364
-0
lines changed

bqetl_project.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ retention_exclusion_list:
569569
- sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_v3
570570
- sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v1
571571
- sql/moz-fx-data-shared-prod/telemetry_derived/clients_first_seen_28_days_later_v3
572+
- sql/moz-fx-data-shared-prod/firefox_desktop_derived/clients_first_seen_28_days_later_v1
572573
- sql/moz-fx-data-shared-prod/org_mozilla_firefox_derived/baseline_clients_first_seen_v1
573574
- sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/baseline_clients_first_seen_v1
574575
- sql/moz-fx-data-shared-prod/fenix_derived/ltv_states_v1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
friendly_name: Clients First Seen 28 Days Later
2+
description: |-
3+
Measures retention of client cohorts 28 days after their first seen date, broken
4+
out by different information, like attribution information, OS, country, ISP, etc.
5+
owners:
6+
7+
labels:
8+
owner: kwindau
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE OR REPLACE VIEW
2+
`moz-fx-data-shared-prod.firefox_desktop.clients_first_seen_28_days_later`
3+
AS
4+
SELECT
5+
*
6+
FROM
7+
`moz-fx-data-shared-prod.firefox_desktop_derived.clients_first_seen_28_days_later_v1`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
friendly_name: Clients First Seen 28 Days Later
2+
description: |-
3+
Measures retention of client cohorts 28 days after their first seen date, broken
4+
out by different information, like attribution information, OS, country, ISP, etc.
5+
owners:
6+
7+
8+
labels:
9+
incremental: true
10+
owner1: kwindau
11+
table_type: client_level
12+
scheduling:
13+
dag_name: bqetl_analytics_tables
14+
date_partition_offset: -27
15+
date_partition_parameter: null
16+
depends_on_past: true
17+
parameters:
18+
- submission_date:DATE:{{ds}}
19+
bigquery:
20+
time_partitioning:
21+
type: day
22+
field: first_seen_date
23+
require_partition_filter: true
24+
expiration_days: null
25+
clustering:
26+
fields:
27+
- sample_id
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
WITH clients_first_seen_28_days_ago AS (
2+
SELECT
3+
client_id,
4+
sample_id,
5+
baseline_first_seen_date AS first_seen_date,
6+
baseline_architecture AS architecture,
7+
baseline_normalized_app_name AS app_name,
8+
baseline_locale AS locale,
9+
baseline_app_display_version AS app_version,
10+
metric_xpcom_abi AS xpcom_abi,
11+
baseline_distribution_id AS distribution_id,
12+
baseline_distribution_version AS partner_distribution_version,
13+
baseline_distributor AS partner_distributor,
14+
baseline_distributor_channel AS partner_distributor_channel,
15+
baseline_distribution_partner_id AS partner_id,
16+
baseline_attribution.campaign AS attribution_campaign,
17+
baseline_attribution.content AS attribution_content,
18+
baseline_attribution_dltoken AS attribution_dltoken,
19+
baseline_attribution_dlsource AS attribution_dlsource,
20+
baseline_attribution_experiment AS attribution_experiment,
21+
baseline_attribution.medium AS attribution_medium,
22+
baseline_attribution.source AS attribution_source,
23+
baseline_attribution_ua AS attribution_ua,
24+
baseline_attribution_variation AS attribution_variation,
25+
metric_apple_model_id AS apple_model_id,
26+
baseline_isp AS isp_name,
27+
baseline_normalized_channel AS normalized_channel,
28+
baseline_country AS country,
29+
baseline_normalized_os AS normalized_os,
30+
baseline_normalized_os_version AS normalized_os_version,
31+
baseline_startup_profile_selection_reason_first AS startup_profile_selection_reason,
32+
metric_installation_first_seen_admin_user AS installation_first_seen_admin_user,
33+
metric_installation_first_seen_default_path AS installation_first_seen_default_path,
34+
metric_installation_first_seen_failure_reason AS installation_first_seen_failure_reason,
35+
metric_installation_first_seen_from_msi AS installation_first_seen_from_msi,
36+
metric_installation_first_seen_install_existed AS installation_first_seen_install_existed,
37+
metric_installation_first_seen_installer_type AS installation_first_seen_installer_type,
38+
metric_installation_first_seen_other_inst AS installation_first_seen_other_inst,
39+
metric_installation_first_seen_other_msix_inst AS installation_first_seen_other_msix_inst,
40+
metric_installation_first_seen_profdir_existed AS installation_first_seen_profdir_existed,
41+
metric_installation_first_seen_silent AS installation_first_seen_silent,
42+
metric_installation_first_seen_version AS installation_first_seen_version,
43+
baseline_windows_build_number AS windows_build_number,
44+
baseline_windows_version AS windows_version,
45+
baseline_legacy_telemetry_profile_group_id AS profile_group_id
46+
FROM
47+
`moz-fx-data-shared-prod.firefox_desktop.clients_first_seen`
48+
WHERE
49+
baseline_first_seen_date = DATE_SUB(@submission_date, INTERVAL 27 day)
50+
),
51+
clients_first_seen_28_days_ago_with_days_seen AS (
52+
SELECT
53+
clients_first_seen_28_days_ago.*,
54+
cls.days_active_bits,
55+
cls.days_seen_bits,
56+
cls.days_visited_1_uri_bits,
57+
cls.days_interacted_bits,
58+
FROM
59+
clients_first_seen_28_days_ago
60+
LEFT JOIN
61+
`moz-fx-data-shared-prod.firefox_desktop.baseline_clients_last_seen` cls
62+
ON clients_first_seen_28_days_ago.client_id = cls.client_id
63+
AND cls.submission_date = @submission_date
64+
)
65+
SELECT
66+
* REPLACE (
67+
COALESCE(
68+
days_seen_bits,
69+
mozfun.bits28.from_string('0000000000000000000000000000')
70+
) AS days_seen_bits,
71+
COALESCE(
72+
days_active_bits,
73+
mozfun.bits28.from_string('0000000000000000000000000000')
74+
) AS days_active_bits,
75+
COALESCE(
76+
days_visited_1_uri_bits,
77+
mozfun.bits28.from_string('0000000000000000000000000000')
78+
) AS days_visited_1_uri_bits,
79+
COALESCE(
80+
days_interacted_bits,
81+
mozfun.bits28.from_string('0000000000000000000000000000')
82+
) AS days_interacted_bits
83+
),
84+
COALESCE(
85+
BIT_COUNT(mozfun.bits28.from_string('1111111000000000000000000000') & days_seen_bits) >= 5,
86+
FALSE
87+
) AS activated,
88+
COALESCE(
89+
BIT_COUNT(mozfun.bits28.from_string('0111111111111111111111111111') & days_seen_bits) > 0,
90+
FALSE
91+
) AS returned_second_day,
92+
COALESCE(
93+
BIT_COUNT(
94+
mozfun.bits28.from_string(
95+
'0111111111111111111111111111'
96+
) & days_visited_1_uri_bits & days_interacted_bits
97+
) > 0,
98+
FALSE
99+
) AS qualified_second_day,
100+
COALESCE(
101+
BIT_COUNT(mozfun.bits28.from_string('0000000000000000000001111111') & days_seen_bits) > 0,
102+
FALSE
103+
) AS retained_week4,
104+
COALESCE(
105+
BIT_COUNT(
106+
mozfun.bits28.from_string(
107+
'0000000000000000000001111111'
108+
) & days_visited_1_uri_bits & days_interacted_bits
109+
) > 0,
110+
FALSE
111+
) AS qualified_week4,
112+
@submission_date AS submission_date
113+
FROM
114+
clients_first_seen_28_days_ago_with_days_seen
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
fields:
2+
- name: client_id
3+
type: STRING
4+
mode: NULLABLE
5+
description: A unique identifier (UUID) for the client.
6+
- name: sample_id
7+
type: INTEGER
8+
mode: NULLABLE
9+
description: A number, 0-99, that samples by client_id and allows filtering data
10+
for analysis. It is a pipeline-generated artifact that should match between pings.
11+
- name: first_seen_date
12+
type: DATE
13+
mode: NULLABLE
14+
description: Date when the server first received a ping from this client.
15+
- name: architecture
16+
type: STRING
17+
mode: NULLABLE
18+
description: The architecture of the device, (e.g. "arm", "x86").
19+
- name: app_name
20+
type: STRING
21+
mode: NULLABLE
22+
description: The name of the browser.
23+
- name: locale
24+
type: STRING
25+
mode: NULLABLE
26+
description: Set of language- and/or country-based preferences for a user interface.
27+
- name: app_version
28+
type: STRING
29+
mode: NULLABLE
30+
description: User visible version string (e.g. "1.0.3") for the browser.
31+
- name: xpcom_abi
32+
type: STRING
33+
mode: NULLABLE
34+
description: |-
35+
A string tag identifying the binary ABI of the current processor and compiler vtable.
36+
This is taken from the TARGET_XPCOM_ABI configure variable.
37+
It may not be available on all platforms, especially unusual processor or compiler combinations.
38+
For example: x86-msvc or ppc-gcc3. This value should almost always be used in combination with the operating system.
39+
- name: distribution_id
40+
type: STRING
41+
mode: NULLABLE
42+
description: The distribution id associated with the install of Firefox.
43+
- name: partner_distribution_version
44+
type: STRING
45+
mode: NULLABLE
46+
description: pref distribution.version, null on failure
47+
- name: partner_distributor
48+
type: STRING
49+
mode: NULLABLE
50+
description: pref app.distributor, null on failure
51+
- name: partner_distributor_channel
52+
type: STRING
53+
mode: NULLABLE
54+
description: pref app.distributor.channel, null on failure
55+
- name: partner_id
56+
type: STRING
57+
mode: NULLABLE
58+
description: pref mozilla.partner.id, null on failure
59+
- name: attribution_campaign
60+
type: STRING
61+
mode: NULLABLE
62+
description: The attribution campaign; similar or the same as UTM campaign.
63+
- name: attribution_content
64+
type: STRING
65+
mode: NULLABLE
66+
description: The attribution content; similar or the same as UTM content.
67+
- name: attribution_dltoken
68+
type: STRING
69+
mode: NULLABLE
70+
- name: attribution_dlsource
71+
type: STRING
72+
mode: NULLABLE
73+
- name: attribution_experiment
74+
type: STRING
75+
mode: NULLABLE
76+
description: The attribution experiment key.
77+
- name: attribution_medium
78+
type: STRING
79+
mode: NULLABLE
80+
description: The attribution medium; similar or the same as UTM medium.
81+
- name: attribution_source
82+
type: STRING
83+
mode: NULLABLE
84+
description: The attribution source; similar or the same as UTM source.
85+
- name: attribution_ua
86+
type: STRING
87+
mode: NULLABLE
88+
- name: attribution_variation
89+
type: STRING
90+
mode: NULLABLE
91+
description: The attribution variation key.
92+
- name: apple_model_id
93+
type: STRING
94+
mode: NULLABLE
95+
- name: isp_name
96+
type: STRING
97+
mode: NULLABLE
98+
description: The name of the internet service provider associated with the client's
99+
IP address.
100+
- name: normalized_channel
101+
type: STRING
102+
mode: NULLABLE
103+
description: The normalized channel the application is being distributed on.
104+
- name: country
105+
type: STRING
106+
mode: NULLABLE
107+
description: Name of the country in which the activity took place, as determined
108+
by the IP geolocation.
109+
- name: normalized_os
110+
type: STRING
111+
mode: NULLABLE
112+
description: The normalized name of the operating system running at the client.
113+
- name: normalized_os_version
114+
type: STRING
115+
mode: NULLABLE
116+
description: Version of the operating system version running at the client. E.g.
117+
"100.9.11".
118+
- name: startup_profile_selection_reason
119+
type: STRING
120+
mode: NULLABLE
121+
- name: installation_first_seen_admin_user
122+
type: BOOLEAN
123+
mode: NULLABLE
124+
description: Whether the installer is running from an elevated admin user
125+
- name: installation_first_seen_default_path
126+
type: BOOLEAN
127+
mode: NULLABLE
128+
description: Whether the default path was used (optional, present if intaller_type is "full")
129+
- name: installation_first_seen_failure_reason
130+
type: STRING
131+
mode: NULLABLE
132+
description: Only sent if unable to collect firstSeen data.
133+
Can have value "NotFoundError" if file not found or other values depending on the failure reason.
134+
- name: installation_first_seen_from_msi
135+
type: BOOLEAN
136+
mode: NULLABLE
137+
description: Whether this was an MSI install (optional, present if intaller_type is "full")
138+
- name: installation_first_seen_install_existed
139+
type: BOOLEAN
140+
mode: NULLABLE
141+
description: Whether there was already an install in this location
142+
- name: installation_first_seen_installer_type
143+
type: STRING
144+
mode: NULLABLE
145+
description: The type of installer used to install Firefox. The value is one of "stub", "full", or "msix".
146+
- name: installation_first_seen_other_inst
147+
type: BOOLEAN
148+
mode: NULLABLE
149+
description: Whether there was already any non-MSIX install on this system.
150+
- name: installation_first_seen_other_msix_inst
151+
type: BOOLEAN
152+
mode: NULLABLE
153+
description: Whether there was already any MSIX install on this system.
154+
- name: installation_first_seen_profdir_existed
155+
type: BOOLEAN
156+
mode: NULLABLE
157+
description: Whether the top-level profile directory existed.
158+
- name: installation_first_seen_silent
159+
type: BOOLEAN
160+
mode: NULLABLE
161+
description: Whether this was a silent install (optional, present if installer_type is "full")
162+
- name: installation_first_seen_version
163+
type: STRING
164+
mode: NULLABLE
165+
description: The application version installed by the installer (not necessarily the current version)
166+
- name: windows_build_number
167+
type: INTEGER
168+
mode: NULLABLE
169+
- name: windows_version
170+
type: STRING
171+
mode: NULLABLE
172+
- name: profile_group_id
173+
type: STRING
174+
mode: NULLABLE
175+
description: A UUID uniquely identifying the profile group, not shared with other
176+
telemetry data.
177+
- name: days_seen_bits
178+
type: INTEGER
179+
mode: NULLABLE
180+
- name: days_active_bits
181+
type: INTEGER
182+
mode: NULLABLE
183+
- name: days_visited_1_uri_bits
184+
type: INTEGER
185+
mode: NULLABLE
186+
- name: days_interacted_bits
187+
type: INTEGER
188+
mode: NULLABLE
189+
- name: activated
190+
type: BOOLEAN
191+
mode: NULLABLE
192+
- name: returned_second_day
193+
type: BOOLEAN
194+
mode: NULLABLE
195+
- name: qualified_second_day
196+
type: BOOLEAN
197+
mode: NULLABLE
198+
- name: retained_week4
199+
type: BOOLEAN
200+
mode: NULLABLE
201+
- name: qualified_week4
202+
type: BOOLEAN
203+
mode: NULLABLE
204+
- name: submission_date
205+
type: DATE
206+
mode: NULLABLE
207+
description: The date when the telemetry ping is received on the server side.

0 commit comments

Comments
 (0)