with ssd as
(select p.visit_id,p.page_url,count(p.id) as page_views,v.create_ts, max(p.create_ts) as last_action_ts,
abs(datediff(s,max(p.create_ts),v.create_ts)) as session_duration,
case
when session_duration >= 0 and session_duration <= 10 then '0 - 10 seconds'
when session_duration >= 11 and session_duration <= 30 then '11 - 30 seconds'
when session_duration >= 31 and session_duration <= 60 then '31 - 60 seconds'
when session_duration >= 61 and session_duration <= 180 then '61 - 180 seconds'
when session_duration >= 181 and session_duration <= 600 then '181 - 600 seconds'
when session_duration >= 601 and session_duration <= 1800 then '601 - 1800 seconds'
else '1801+seconds'
end as session_bucket
from _fxm_events p
join _fxm_visits v on v.id = p.visit_id
where p.name = '_fxm.pages.view' and
(create_ts between '{{start_timestamp}}' and '{{end_timestamp}}')
group by p.visit_id,v.create_ts,p.page_url
)
select * from ssd
hello.sh
# Ain't no code for that yet, sorry
echo 'You got to trust me on this, I saved the world'