Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrittman/8c643a4673dc1483a6563d27623c630e to your computer and use it in GitHub Desktop.
Save markrittman/8c643a4673dc1483a6563d27623c630e to your computer and use it in GitHub Desktop.
Script to compare the page views logged by Segment and Rudderstack for the same page, used when the page view counts for the two sources differ
with segment_pageviews as (
select
'segment' as source, id, timestamp_trunc(timestamp,HOUR) as timestamp_minute, path, context_page_title, anonymous_id, user_id, context_ip
from
`ra-development.company_website.pages_view` p
where
date(timestamp_trunc(p.received_at,DAY)) > '2023-05-10'
and context_page_title = 'Adding Looker Regression Tests to the dbtCloud CI/CD Pipeline using Spectacles — Rittman Analytics'
),
rudderstack_pageviews as (
select
'rudderstack' as source, id, timestamp_trunc(timestamp,HOUR) as timestamp_minute, path, context_page_title, anonymous_id, user_id, context_ip
from
`ra-development.rudderstack_ra_website.pages_view` p
where
date(timestamp_trunc(p.received_at,DAY)) > '2023-05-10'
and context_page_title = 'Adding Looker Regression Tests to the dbtCloud CI/CD Pipeline using Spectacles — Rittman Analytics'
)
select *
from segment_pageviews
union all
select *
from rudderstack_pageviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment