Skip to content

Commit 24015a5

Browse files
author
CircleCI generate-sql job
committed
Auto-push due to change on main branch [ci skip]
1 parent 3c1547b commit 24015a5

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_sessions_v2/query.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ WITH device_properties_at_session_start_event AS (
4646
WHERE
4747
_table_suffix = FORMAT_DATE('%Y%m%d', @submission_date)
4848
AND e.key = 'ga_session_id'
49-
AND e.value.int_value IS NOT NULL
49+
AND e.value.int_value IS NOT NULL --only keep rows where GA session ID is not null
5050
AND a.event_name = 'session_start'
5151
QUALIFY
52-
rnk = 1
52+
rnk = 1 --if a ga_session_id / user_pseudo_id / session_date has more than 1 session_start, only keep 1 since a unique session should only have 1 session start
5353
),
5454
--get all the details for that session from the session date and the next day
5555
event_aggregates AS (
@@ -71,7 +71,7 @@ event_aggregates AS (
7171
BETWEEN FORMAT_DATE('%Y%m%d', @submission_date)
7272
AND FORMAT_DATE('%Y%m%d', DATE_ADD(@submission_date, INTERVAL 1 DAY))
7373
AND e.key = 'ga_session_id'
74-
AND e.value.int_value IS NOT NULL
74+
AND e.value.int_value IS NOT NULL --only keep rows where GA session ID is not null
7575
GROUP BY
7676
a.user_pseudo_id,
7777
CAST(e.value.int_value AS string)
@@ -163,7 +163,7 @@ landing_page_by_session_staging AS (
163163
BETWEEN FORMAT_DATE('%Y%m%d', @submission_date)
164164
AND FORMAT_DATE('%Y%m%d', DATE_ADD(@submission_date, INTERVAL 1 DAY))
165165
AND e.key = 'entrances'
166-
AND e.value.int_value = 1
166+
AND e.value.int_value = 1 --filter to the entrance page view of the session (key = entrances, int_value = 1 to get the landing page of the session)
167167
),
168168
landing_page_by_session AS (
169169
SELECT
@@ -181,7 +181,7 @@ landing_page_by_session AS (
181181
FROM
182182
landing_page_by_session_staging
183183
QUALIFY
184-
lp_rnk = 1
184+
lp_rnk = 1 --if there are ever multiple entrances in the same session, pick only 1 (rare but occasionally happens)
185185
),
186186
install_targets_staging AS (
187187
SELECT
@@ -242,7 +242,7 @@ SELECT
242242
ELSE FALSE
243243
END AS is_first_session,
244244
a.ga_session_number AS session_number,
245-
b.max_event_timestamp - b.min_event_timestamp AS time_on_site,
245+
CAST((b.max_event_timestamp - b.min_event_timestamp) / 1000000 AS int64) AS time_on_site,
246246
b.pageviews,
247247
a.country,
248248
a.region,

sql/moz-fx-data-shared-prod/mozilla_org_derived/ga_sessions_v2/schema.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fields:
2222
- name: time_on_site
2323
mode: NULLABLE
2424
type: INTEGER
25-
description: "Amount of time the user was on the site for this session."
25+
description: "The time in seconds between the first and last event of the session"
2626
- name: pageviews
2727
mode: NULLABLE
2828
type: INTEGER

sql/moz-fx-data-shared-prod/telemetry/releases_latest/schema.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ fields:
22
- name: date
33
type: DATE
44
mode: NULLABLE
5+
description: null
56
- name: product
67
type: STRING
78
mode: NULLABLE
89
- name: category
910
type: STRING
1011
mode: NULLABLE
12+
description: null
1113
- name: channel
1214
type: STRING
1315
mode: NULLABLE
1416
- name: build_number
1517
type: INTEGER
1618
mode: NULLABLE
19+
description: null
1720
- name: release_date
1821
type: DATE
1922
mode: NULLABLE

0 commit comments

Comments
 (0)