Skip to content

Commit 00668b7

Browse files
committed
add all daily fields to usage_reporting_clients_last_seen_v1 and usage_reporting_clients_first_seen_v1 to allow proper wau and mau segmentation
1 parent 4957d26 commit 00668b7

File tree

4 files changed

+161
-6
lines changed

4 files changed

+161
-6
lines changed

sql_generators/usage_reporting/templates/usage_reporting_clients_first_seen_v1.query.sql.jinja

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
WITH
33
_current AS (
44
SELECT
5-
usage_profile_id,
65
{% raw %}
76
{% if is_init() %}
87
MIN(submission_date) AS first_seen_date,
98
{% else %}
109
@submission_date AS first_seen_date,
1110
{% endif %}
1211
{% endraw %}
12+
* EXCEPT(submission_date),
1313
FROM
1414
`{{ project_id }}.{{ channel_dataset }}.usage_reporting_clients_daily`
1515
WHERE
@@ -40,8 +40,7 @@ _previous AS (
4040
)
4141

4242
SELECT
43-
first_seen_date,
44-
usage_profile_id,
43+
_current.*,
4544
FROM
4645
_current
4746
LEFT JOIN

sql_generators/usage_reporting/templates/usage_reporting_clients_first_seen_v1.schema.yaml.jinja

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,83 @@ fields:
99
- mode: NULLABLE
1010
name: usage_profile_id
1111
type: STRING
12+
description:
13+
14+
- mode: NULLABLE
15+
name: first_run_date
16+
type: DATE
17+
description: |
18+
The date of the first run of the application.
19+
20+
- mode: NULLABLE
21+
name: app_channel
22+
type: STRING
23+
description: |
24+
The channel the application is being distributed on.
25+
26+
- mode: NULLABLE
27+
name: normalized_country_code
28+
type: STRING
29+
description: |
30+
Country code
31+
32+
- mode: NULLABLE
33+
name: os
34+
type: STRING
35+
description: |
36+
The name of the operating system.
37+
38+
- mode: NULLABLE
39+
name: os_version
40+
type: STRING
41+
description: |
42+
The user-visible version of the operating system (e.g. "1.2.3").
43+
If the version detection fails, this metric gets set to Unknown.
44+
45+
- mode: NULLABLE
46+
name: app_build
47+
type: STRING
48+
description: |
49+
The build identifier generated by the CI system (e.g. "1234/A").
50+
If the value was not provided through configuration, this metric gets set to Unknown.
51+
52+
- mode: NULLABLE
53+
name: app_display_version
54+
type: STRING
55+
description: |
56+
The user visible version string (e.g. "1.0.3").
57+
If the value was not provided through configuration, this metric gets set to Unknown.
58+
59+
- mode: NULLABLE
60+
name: distribution_id
61+
type: STRING
62+
description: |
63+
A string containing the distribution identifier. This was used to identify installs
64+
from Mozilla Online, but now also identifies partnership deal distributions.
65+
66+
- mode: NULLABLE
67+
name: is_default_browser
68+
type: BOOLEAN
69+
description: |
70+
Is Firefox the default browser.
71+
72+
- mode: NULLABLE
73+
name: reason
74+
type: STRING
1275
description: |
13-
A UUID of the usage_profile.
76+
The optional reason the ping was submitted. The specific values for reason are specific to each ping,
77+
and are documented in the ping's pings.yaml file.
78+
79+
- mode: NULLABLE
80+
name: is_active
81+
type: BOOLEAN
82+
description: |
83+
A flag field indicating whether the specific client was active.
84+
{% if app_name == "firefox_desktop" -%}
85+
- mode: NULLABLE
86+
name: windows_build_number
87+
type: INTEGER
88+
description: |
89+
The optional Windows build number, reported by Windows (e.g. 22000) and not set for other platforms.
90+
{%- endif -%}
91+

sql_generators/usage_reporting/templates/usage_reporting_clients_last_seen_v1.query.sql.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
-- 28 days for each usage criterion as a single 64-bit integer.
44
WITH _current AS (
55
SELECT
6-
usage_profile_id,
76
-- The rightmost bit in 'days_since_seen' represents whether the user sent a usage_reporting ping on the submission_date.
87
CAST(TRUE AS INT64) AS days_seen_bits,
98
-- The rightmost bit in days_active_bits represents whether the user counts as active on the submission_date.
@@ -14,6 +13,7 @@ WITH _current AS (
1413
{% if channel_dataset == "org_mozilla_ios_focus" %}
1514
app_channel,
1615
{% endif %}
16+
*,
1717
FROM
1818
`{{ project_id }}.{{ channel_dataset }}.usage_reporting_clients_daily`
1919
WHERE
@@ -50,7 +50,7 @@ SELECT
5050
_previous.days_created_profile_bits,
5151
_current.days_created_profile_bits
5252
) AS days_created_profile_bits
53-
)
53+
),
5454
FROM
5555
_current
5656
FULL JOIN

sql_generators/usage_reporting/templates/usage_reporting_clients_last_seen_v1.schema.yaml.jinja

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,81 @@ fields:
3737
description: |
3838
The channel the application is being distributed on.
3939
{% endif %}
40+
41+
- mode: NULLABLE
42+
name: first_run_date
43+
type: DATE
44+
description: |
45+
The date of the first run of the application.
46+
47+
- mode: NULLABLE
48+
name: app_channel
49+
type: STRING
50+
description: |
51+
The channel the application is being distributed on.
52+
53+
- mode: NULLABLE
54+
name: normalized_country_code
55+
type: STRING
56+
description: |
57+
Country code
58+
59+
- mode: NULLABLE
60+
name: os
61+
type: STRING
62+
description: |
63+
The name of the operating system.
64+
65+
- mode: NULLABLE
66+
name: os_version
67+
type: STRING
68+
description: |
69+
The user-visible version of the operating system (e.g. "1.2.3").
70+
If the version detection fails, this metric gets set to Unknown.
71+
72+
- mode: NULLABLE
73+
name: app_build
74+
type: STRING
75+
description: |
76+
The build identifier generated by the CI system (e.g. "1234/A").
77+
If the value was not provided through configuration, this metric gets set to Unknown.
78+
79+
- mode: NULLABLE
80+
name: app_display_version
81+
type: STRING
82+
description: |
83+
The user visible version string (e.g. "1.0.3").
84+
If the value was not provided through configuration, this metric gets set to Unknown.
85+
86+
- mode: NULLABLE
87+
name: distribution_id
88+
type: STRING
89+
description: |
90+
A string containing the distribution identifier. This was used to identify installs
91+
from Mozilla Online, but now also identifies partnership deal distributions.
92+
93+
- mode: NULLABLE
94+
name: is_default_browser
95+
type: BOOLEAN
96+
description: |
97+
Is Firefox the default browser.
98+
99+
- mode: NULLABLE
100+
name: reason
101+
type: STRING
102+
description: |
103+
The optional reason the ping was submitted. The specific values for reason are specific to each ping,
104+
and are documented in the ping's pings.yaml file.
105+
106+
- mode: NULLABLE
107+
name: is_active
108+
type: BOOLEAN
109+
description: |
110+
A flag field indicating whether the specific client was active.
111+
{% if app_name == "firefox_desktop" -%}
112+
- mode: NULLABLE
113+
name: windows_build_number
114+
type: INTEGER
115+
description: |
116+
The optional Windows build number, reported by Windows (e.g. 22000) and not set for other platforms.
117+
{%- endif -%}

0 commit comments

Comments
 (0)