Skip to content

Commit

Permalink
remove page_path and page_title from fct_ga4__pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dgitis committed Jan 22, 2024
1 parent 0bb57e4 commit 944ded7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions models/marts/core/fct_ga4__pages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ with page_view as (
stream_id,
page_location, -- includes query string parameters not listed in query_parameter_exclusions variable
page_key,
page_path,
page_title, -- would like to move this to dim_ga4__pages but need to think how to handle page_title changing over time
page_engagement_key,
count(event_name) as page_views,
count(distinct client_key ) as distinct_client_keys,
Expand All @@ -33,15 +31,13 @@ from {{ref('stg_ga4__event_page_view')}}
{% if is_incremental() %}
where event_date_dt in ({{ partitions_to_replace | join(',') }})
{% endif %}
group by 1,2,3,4,5,6,7
group by 1,2,3,4,5
), page_engagement as (
select
page_view.event_date_dt,
page_view.stream_id,
page_view.page_location,
page_view.page_title,
page_view.page_key,
page_view.page_path,
sum(page_view.page_views) as page_views, -- page_engagement_key references the page_referrer; need to re-aggregate metrics
sum(page_view.distinct_client_keys) as distinct_client_keys,
sum(page_view.new_client_keys) as new_client_keys,
Expand All @@ -50,18 +46,17 @@ from {{ref('stg_ga4__event_page_view')}}
sum( page_engagement_denominator) as avg_engagement_time_denominator
from {{ ref('stg_ga4__page_engaged_time') }}
right join page_view using (page_engagement_key)
group by 1,2,3,4,5,6
group by 1,2,3,4
), scroll as (
select
event_date_dt,
page_location,
page_title,
count(event_name) as scroll_events
from {{ref('stg_ga4__event_scroll')}}
{% if is_incremental() %}
where event_date_dt in ({{ partitions_to_replace | join(',') }})
{% endif %}
group by 1,2,3
group by 1,2
)
{% if var('conversion_events',false) %}
,
Expand All @@ -75,11 +70,11 @@ select
join_conversions.* except (page_key),
ifnull(scroll.scroll_events, 0) as scroll_events
from join_conversions
left join scroll using (event_date_dt, page_location, page_title)
left join scroll using (event_date_dt, page_location)
{% else %}
select
page_engagement.* except (page_key),
ifnull(scroll.scroll_events, 0) as scroll_events
from page_engagement
left join scroll using (event_date_dt, page_location, page_title)
left join scroll using (event_date_dt, page_location)
{% endif %}

0 comments on commit 944ded7

Please sign in to comment.