Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. /* What does the new service funnel look like for users who saw the landing page? */
  2. select name, count(*) views from
  3. (
  4. select message:event:domain || '.' || message:event:object name, message:event:user:uuid uuid, min(timestamp)
  5. from prod.event_bus_prod.eb_events
  6. where timestamp > '2019-04-08 22:02:00.000'
  7. and type like 'event.eventstream.home_services.%.viewed'
  8. and uuid in
  9. (
  10. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  11. where type = 'event.eventstream.home_services.landing.viewed'
  12. and timestamp > '2019-04-08 22:02:00.000'
  13. )
  14. group by 1, 2
  15. )
  16. group by name
  17. order by views desc
  18.  
  19. /* How many users saw both transfer and new service flows? */
  20. select count(*) from (
  21. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  22. where type = 'event.eventstream.home_services.landing.viewed'
  23. and timestamp > '2019-04-08 22:02:00.000'
  24. intersect
  25. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  26. where type = 'event.eventstream.home_services.transfer_call.viewed'
  27. and timestamp > '2019-04-08 22:02:00.000'
  28. intersect
  29. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  30. where type = 'event.eventstream.home_services.internet_speed.viewed'
  31. and timestamp > '2019-04-08 22:02:00.000'
  32. )
  33.  
  34. /* How many users saw both transfer call and browse offers pages? */
  35. select count(*) from (
  36. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  37. where type = 'event.eventstream.home_services.landing.viewed'
  38. and timestamp > '2019-04-08 22:02:00.000'
  39. intersect
  40. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  41. where type = 'event.eventstream.home_services.transfer_call.viewed'
  42. and timestamp > '2019-04-08 22:02:00.000'
  43. intersect
  44. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  45. where type = 'event.eventstream.home_services.browse_offers.viewed'
  46. and timestamp > '2019-04-08 22:02:00.000'
  47. )
  48.  
  49. /* Of people who see the landing page, where do they go next? */
  50. select next_page, count(*) frequency from
  51. (
  52. select array_position('home_services.landing'::variant, journey) landing_index, journey[landing_index + 1] next_page from
  53. (
  54. select message:event:user:uuid uuid,
  55. array_agg(message:event:domain || '.' || message:event:object) within group (order by timestamp) journey
  56. from prod.event_bus_prod.eb_events
  57. where type like 'event.eventstream.%.viewed'
  58. and timestamp > '2019-04-08 22:02:00.000'
  59. group by uuid
  60. )
  61. where landing_index is not null
  62. )
  63. group by next_page
  64. order by frequency desc
  65.  
  66. /* How many people click new service vs. transfer service? */
  67. select (
  68. select count(distinct message:event:user:uuid) from prod.event_bus_prod.eb_events
  69. where type = 'event.eventstream.home_services.new_service.clicked'
  70. and timestamp > '2019-04-08 22:02:00.000'
  71. and message:event:user:test != true
  72. ) new_service,
  73. ( select count(distinct message:event:user:uuid) from prod.event_bus_prod.eb_events
  74. where type = 'event.eventstream.home_services.transfer_service.clicked'
  75. and timestamp > '2019-04-08 22:02:00.000'
  76. and message:event:user:test != true
  77. ) transfer_service,
  78. new_service + transfer_service total,
  79. new_service * 100.0 / total new_service_percentage,
  80. transfer_service * 100.0 / total transfer_service_percentage
  81.  
  82. /* What is the next step breakdown for users who saw the landing page? */
  83. with transfer_option_users as
  84. (
  85. select distinct message:event:user:uuid uuid from prod.event_bus_prod.eb_events
  86. where type = 'event.eventstream.home_services.landing.viewed'
  87. and timestamp > '2019-04-08 22:02:00.000'
  88. )
  89. select journey[next_step_index - 1] previous_page, count(*) page_views, count(*) * 100.0 / sum(count(*)) over() percentage from
  90. (
  91. select journey, array_position('mover.next_step'::variant, journey) next_step_index from
  92. (
  93. select array_agg(name) within group (order by timestamp) journey from
  94. (
  95. select message:event:domain || '.' || message:event:object name, message:event:user:email email, message:event:user:test test, timestamp
  96. from prod.event_bus_prod.eb_events e inner join transfer_option_users u on e.message:event:user:uuid = u.uuid
  97. where type like 'event.eventstream.%.viewed'
  98. and test != true
  99. and timestamp > '2019-04-08 22:02:00.000'
  100. )
  101. group by email
  102. )
  103. where next_step_index is not null
  104. )
  105. group by previous_page
  106. order by page_views desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement