Skip to content

Commit

Permalink
Auto-push due to change on main branch [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
CircleCI generate-sql job committed Feb 6, 2024
1 parent 3c1547b commit 24015a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Expand Up @@ -46,10 +46,10 @@ WITH device_properties_at_session_start_event AS (
WHERE
_table_suffix = FORMAT_DATE('%Y%m%d', @submission_date)
AND e.key = 'ga_session_id'
AND e.value.int_value IS NOT NULL
AND e.value.int_value IS NOT NULL --only keep rows where GA session ID is not null
AND a.event_name = 'session_start'
QUALIFY
rnk = 1
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
),
--get all the details for that session from the session date and the next day
event_aggregates AS (
Expand All @@ -71,7 +71,7 @@ event_aggregates AS (
BETWEEN FORMAT_DATE('%Y%m%d', @submission_date)
AND FORMAT_DATE('%Y%m%d', DATE_ADD(@submission_date, INTERVAL 1 DAY))
AND e.key = 'ga_session_id'
AND e.value.int_value IS NOT NULL
AND e.value.int_value IS NOT NULL --only keep rows where GA session ID is not null
GROUP BY
a.user_pseudo_id,
CAST(e.value.int_value AS string)
Expand Down Expand Up @@ -163,7 +163,7 @@ landing_page_by_session_staging AS (
BETWEEN FORMAT_DATE('%Y%m%d', @submission_date)
AND FORMAT_DATE('%Y%m%d', DATE_ADD(@submission_date, INTERVAL 1 DAY))
AND e.key = 'entrances'
AND e.value.int_value = 1
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)
),
landing_page_by_session AS (
SELECT
Expand All @@ -181,7 +181,7 @@ landing_page_by_session AS (
FROM
landing_page_by_session_staging
QUALIFY
lp_rnk = 1
lp_rnk = 1 --if there are ever multiple entrances in the same session, pick only 1 (rare but occasionally happens)
),
install_targets_staging AS (
SELECT
Expand Down Expand Up @@ -242,7 +242,7 @@ SELECT
ELSE FALSE
END AS is_first_session,
a.ga_session_number AS session_number,
b.max_event_timestamp - b.min_event_timestamp AS time_on_site,
CAST((b.max_event_timestamp - b.min_event_timestamp) / 1000000 AS int64) AS time_on_site,
b.pageviews,
a.country,
a.region,
Expand Down
Expand Up @@ -22,7 +22,7 @@ fields:
- name: time_on_site
mode: NULLABLE
type: INTEGER
description: "Amount of time the user was on the site for this session."
description: "The time in seconds between the first and last event of the session"
- name: pageviews
mode: NULLABLE
type: INTEGER
Expand Down
Expand Up @@ -2,18 +2,21 @@ fields:
- name: date
type: DATE
mode: NULLABLE
description: null
- name: product
type: STRING
mode: NULLABLE
- name: category
type: STRING
mode: NULLABLE
description: null
- name: channel
type: STRING
mode: NULLABLE
- name: build_number
type: INTEGER
mode: NULLABLE
description: null
- name: release_date
type: DATE
mode: NULLABLE
Expand Down

0 comments on commit 24015a5

Please sign in to comment.