Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am using Bigquery. I am trying to find bounce percentage for each app version. A bounced user is defined as a user who first

I am using Bigquery.
I am trying to find bounce percentage for each app version. A bounced user is defined as a user who first launched the app in the selected date range, then removed the app (in the selected date range) after using the app only once, i.e. a single session.
Here is my code:
with launched as (
select distinct user_pseudo_id as total_distinct_users
FROM `rayn-deen-app.analytics_317927526.events_*`
where
user_pseudo_id in (
SELECT distinct user_pseudo_id
FROM `rayn-deen-app.analytics_317927526.events_*`
WHERE
event_name = 'first_open'
AND event_date
BETWEEN
@DS_START_DATE AND @DS_END_DATE
))
,
demo_launched as
(SELECT
user_pseudo_id,
--country
--operating_system,
--device_brand,
--device_model,
--os_with_version,
app_info_version
--traffic_source_name
--language
FROM rayn-deen-app.churn_analysis.user_demographics
where user_pseudo_id in (select * from launched)
)
,
removed as (
select distinct user_pseudo_id as total_distinct_users
FROM `rayn-deen-app.analytics_317927526.events_*`
WHERE user_pseudo_id IN (
SELECT distinct user_pseudo_id
FROM `rayn-deen-app.analytics_317927526.events_*`
WHERE event_name = "app_remove"
AND event_date
BETWEEN
@DS_START_DATE AND @DS_END_DATE
)
AND event_name = 'first_open'
AND event_date
BETWEEN
@DS_START_DATE AND @DS_END_DATE
)
,
counts as(
select user_pseudo_id, count(event_name) as event_countss
from `rayn-deen-app.analytics_317927526.events_*`
where event_name='session_start'
and user_pseudo_id in (select * from removed)
group by user_pseudo_id
)
,
dataset as
(select distinct user_pseudo_id from counts where event_countss=1)
,
demo_bounced as
(SELECT
user_pseudo_id,
--country
--operating_system,
--device_brand,
--device_model,
--os_with_version,
app_info_version
--traffic_source_name
--language
FROM rayn-deen-app.churn_analysis.user_demographics
where user_pseudo_id in (select * from dataset)
)
,
group_launched as (
select app_info_version ,count(distinct user_pseudo_id) as launched_users
from demo_launched
group by app_info_version)
,
group_bounced as (
select app_info_version ,count(distinct user_pseudo_id) as bounced_users
from demo_bounced
group by app_info_version
order by bounced_users desc
--limit 10
)
,
final as (
select group_launched.app_info_version, group_bounced.bounced_users ,round((bounced_users/launched_users)*100) as percentage_bounced
from group_launched
right join group_bounced
on group_launched.app_info_version=group_bounced.app_info_version
)
select * from final
where app_info_version<>'null'
order by final.bounced_users desc
-------------------------
I wanted to get this checked, because it is producing some unusual results.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Would giving rewards or administering punishments be

Answered: 1 week ago

Question

What impediments deal with regulators?

Answered: 1 week ago

Question

What are their performance levels?

Answered: 1 week ago