Skip to content

Instantly share code, notes, and snippets.

@jonhilgart22
Created September 12, 2018 19:12
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 jonhilgart22/52ffa05c35eae1c7357e09d9a2f191fa to your computer and use it in GitHub Desktop.
Save jonhilgart22/52ffa05c35eae1c7357e09d9a2f191fa to your computer and use it in GitHub Desktop.
select
a.subscription_created_at::date,
b.cleaned_source,
b.utm_campaign,
count(distinct b.browser_hash) as n_visits,
count(distinct case when w.first_user_created_event_at is not null then b.user_id else null end) as accounts_created,
count(distinct a.user_id) as credit_cards_added
from analytics.browser_hash_hits b
join analytics.acquisition_waterfall_by_browser_hash w
on w.browser_hash = b.browser_hash
left join analytics.acquisition_credit_card_source_tracking a
on a.user_id = b.user_id
and a.summarized_reporting_cleaned_source ilike '%google%'
where
b.cleaned_source ilike '%google%'
group by 1,2,3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment