Advertisement
YuvalGai

Untitled

Jul 5th, 2023 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. create or replace table candivore.semantic_layer.t_onboarding_funnel as
  2. SELECT date(first_install_DT) as install_cohort
  3. , test_name
  4. , test_group_name
  5. , platform
  6. , truest_media_source
  7. , CASE when action = 'skip_training' then pre_skipped_msg
  8. WHEN message = 'EventFirstEntryWelcome' THEN 'Tutorial Begin'
  9. when action = 'start_match' and match_index = 0 then 'Match_1 Begin'
  10. when message = 'InGameMatch3' then 'Match_1 Intro'
  11. when action = 'show_hint' and match_index = 0 then 'Match_1 Hint'
  12. when message = 'InGameExtraMove' then 'Match_1 Extra Move'
  13. when message = 'FirstGameGoodJob' then 'Match_1 End'
  14. when action = 'start_match' and match_index = 1 then 'Match_2 Begin'
  15. when action = 'show_hint' and match_index = 1 then 'Match_2 Hint'
  16. when message = 'InGameBoosterUnlocked' then 'Match_2 InGame Booster Unlocked'
  17. when message = 'InGameBoosterBarFull' then 'Match_2 InGame Booster Activate'
  18. when message = 'InGameCreateSpecial' then 'Match_2 Create Special'
  19. when action = 'start_match' and match_index = 2 then 'Match_3 Begin'
  20. when action = 'show_hint' and match_index = 2 then 'Match_3 Hint'
  21. when message = 'InGamePerkHammer' then 'Match3_Hammer_Perk_Intro'
  22. when message = 'HammerTutorial' then 'Match3_Hammer_Perk_Tutorial'
  23. when message = 'InGamePerkShuffler' then 'Match3_Shuffle_Perk_Intro'
  24. when message = 'ShufflerTutorial' then 'Match3_Shuffle_Perk_Tutorial'
  25. when action = 'start_match' and match_index = 3 then 'Match_4 Begin'
  26. when action = 'show_hint' and match_index = 3 then 'Match_4 Hint'
  27. when message = 'EventDresserChooseOutfit' then 'Match_4_Choose_Outfit'
  28. when message = 'EventDresserEnterName' then 'Match_4_User_Name'
  29. when message = 'FirstBoosterSelect' then 'Match_4_Booster_Select'
  30. when message = 'FinalGameOneMoveLeft' then 'Match_4_Move_Left'
  31. when message = 'FinalGameTerrificGame' then 'Match_4_Final_Step'
  32. -- when action = 'skip_training' then 'skip_training'
  33.  
  34. ----------------------- END ONBOARDING -----------------------
  35.  
  36. /*when message = 'FinalGameWolfIllGetYou' then 1 else 0 end as tutorialMatch4End
  37. when message = 'HomescreenTutorialTrophies' then 1 else 0 end as tutorialTrophyReward --****
  38. when message = 'HomescreenTutorialPlay' then 1 else 0 end as tutorialHomeScreenPlay --****
  39. when message = 'SoloEventsScreenTutorial' then 1 else 0 end as tutorialSolo
  40. when message = 'SoloInGameTutorial' then 1 else 0 end as tutorialSolo_inGame
  41. when message = 'StickerAlbumsUnlocked' then 1 else 0 end as tutorialStickersUnlocked
  42. when message = 'FirstStickerPlaced' then 1 else 0 end as tutorialStickers
  43. when message = 'HomescreenTutorialTrophies' then seniority end as tutorialEnd --****
  44. when message = 'NewBoosterUnlocked' then seniority end as tutorialNewBoosterUnlocked --****
  45. when message = 'RumbleTutorialWolf' then 1 else 0 end as tutorialRumbleIntro
  46. when message = 'RumbleHomeScreenTutorial' then 1 else 0 end as tutorialRumbleSteps
  47. when message = 'RumbleEventUnlocked1' then 1 else 0 end as tutorialRumbleStep1
  48. when message = 'RumbleEventUnlocked2' then 1 else 0 end as tutorialRumbleStep2
  49. when message = 'OutOfSelectedBooster' then 1 else 0 end as tutorialOutOfSelectedBooster
  50. when message = 'OutOfBoosters' then 1 else 0 end as tutorialOutOfBoosters
  51. when message = 'FirstBoosterLost' then 1 else 0 end as tutorialFirstBoosterLost
  52. when message = 'SoloEventUnlocked1' then 1 else 0 end as tutorialSoloEventUnlocked1
  53. when message = 'RumbleInGameTutorial' then 1 else 0 end as tutorialRumbleInGameTutorial
  54. when message = 'PerksUnlocked' then 1 else 0 end as tutorialPerksUnlocked*/
  55. END tutorial_step
  56. , CASE
  57. WHEN tutorial_step = 'Tutorial Begin' THEN 1
  58. when tutorial_step = 'Match_1 Begin' then 2
  59. when tutorial_step = 'Match_1 Intro' then 3
  60. when tutorial_step = 'Match_1 Hint' then 4
  61. when tutorial_step = 'Match_1 Extra Move' then 5
  62. when tutorial_step = 'Match_1 End' then 6
  63. when tutorial_step = 'Match_2 Begin' then 7
  64. when tutorial_step = 'Match_2 Hint' then 8
  65. when tutorial_step = 'Match_2 InGame Booster Unlocked' then 9
  66. when tutorial_step = 'Match_2 InGame Booster Activate' then 10
  67. when tutorial_step = 'Match_2 Create Special' then 11
  68. when tutorial_step = 'Match_3 Begin' then 12
  69. when tutorial_step = 'Match_3 Hint' then 13
  70. when tutorial_step = 'Match3_Hammer_Perk_Intro' then 16
  71. when tutorial_step = 'Match3_Hammer_Perk_Tutorial' then 17
  72. when tutorial_step = 'Match3_Shuffle_Perk_Intro' then 14
  73. when tutorial_step = 'Match3_Shuffle_Perk_Tutorial' then 15
  74. when tutorial_step = 'Match_4 Begin' then 22
  75. when tutorial_step = 'Match_4 Hint' then 18
  76. when tutorial_step = 'Match_4_Choose_Outfit' then 19
  77. when tutorial_step = 'Match_4_User_Name' then 20
  78. when tutorial_step = 'Match_4_Booster_Select' then 21
  79. when tutorial_step = 'Match_4_Move_Left' then 23
  80. when tutorial_step = 'Match_4_Final_Step' then 24
  81. end tutorial_step_index
  82.  
  83. , CASE
  84. WHEN message = 'EventFirstEntryWelcome' THEN 1
  85. when action = 'start_match' and match_index = 0 then 1
  86. when message = 'InGameMatch3' then 1
  87. when action = 'show_hint' and match_index = 0 then 1
  88. when message = 'InGameExtraMove' then 0
  89. when message = 'FirstGameGoodJob' then 1
  90. when action = 'start_match' and match_index = 1 then 1
  91. when action = 'show_hint' and match_index = 1 then 0
  92. when message = 'InGameBoosterUnlocked' then 1
  93. when message = 'InGameBoosterBarFull' then 1
  94. when message = 'InGameCreateSpecial' then 0
  95. when action = 'start_match' and match_index = 2 then 1
  96. when action = 'show_hint' and match_index = 2 then 0
  97. when message = 'InGamePerkHammer' then 1
  98. when message = 'HammerTutorial' then 0
  99. when message = 'InGamePerkShuffler' then 1
  100. when message = 'ShufflerTutorial' then 0
  101. when action = 'start_match' and match_index = 3 then 1
  102. when action = 'show_hint' and match_index = 3 then 0
  103. when message = 'EventDresserChooseOutfit' then 1
  104. when message = 'EventDresserEnterName' then 1
  105. when message = 'FirstBoosterSelect' then 1
  106. when message = 'FinalGameOneMoveLeft' then 1
  107. when message = 'FinalGameTerrificGame' then 1
  108. when action = 'skip_training' then 2
  109. end mandatory_step
  110.  
  111. --- measures ---
  112. , count(distinct user_id) unique_users
  113. , count(distinct case when action != 'skip_training' then user_id end) unique_users_unskipped
  114. , count(distinct case when action = 'skip_training' and skipped = FALSE then user_id end) unique_users_skipped
  115.  
  116. FROM (select *,case WHEN message = 'EventFirstEntryWelcome' THEN 'Tutorial Begin'
  117. when message = 'InGameMatch3' then 'Match_1 Intro'
  118. when message = 'InGameExtraMove' then 'Match_1 Extra Move'
  119. when message = 'FirstGameGoodJob' then 'Match_1 End'
  120. when message = 'InGameBoosterUnlocked' then 'Match_2 InGame Booster Unlocked'
  121. when message = 'InGameBoosterBarFull' then 'Match_2 InGame Booster Activate'
  122. when message = 'InGameCreateSpecial' then 'Match_2 Create Special'
  123. when message = 'InGamePerkHammer' then 'Match3_Hammer_Perk_Intro'
  124. when message = 'HammerTutorial' then 'Match3_Hammer_Perk_Tutorial'
  125. when message = 'InGamePerkShuffler' then 'Match3_Shuffle_Perk_Intro'
  126. when message = 'ShufflerTutorial' then 'Match3_Shuffle_Perk_Tutorial'
  127. when message = 'EventDresserChooseOutfit' then 'Match_4_Choose_Outfit'
  128. when message = 'EventDresserEnterName' then 'Match_4_User_Name'
  129. when message = 'FirstBoosterSelect' then 'Match_4_Booster_Select'
  130. when message = 'FinalGameOneMoveLeft' then 'Match_4_Move_Left'
  131. when message = 'FinalGameTerrificGame' then 'Match_4_Final_Step'
  132. end message2
  133. ,lag(message2,1)ignore nulls over(partition by user_id order by derived_tstamp) pre_skipped_msg
  134. ,last_value(media_source) over(partition by user_id order by derived_tstamp) truest_media_source
  135. ,first_value(app_version) over(partition by user_id order by derived_tstamp) first_app_version
  136. from CANDIVORE.PROD.F_USER_ONBOARDING
  137. WHERE date(first_install_DT) >= '2023-06-18' and user_id not in (select distinct user_id from candivore.prod.f_client_user_login where action = 'reconnected' and date(derived_tstamp) >= '2023-06-18') and user_id not in (select distinct user_id from candivore.prod.f_client_restore_user where date(derived_tstamp) >= '2023-06-18'))
  138. group by 1,2,3,4,5,6,7,8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement