Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

User Tracking with Google Analytics and how it survives the break of the Globosat Play monolith

439 views

Published on

With user tracking you will be able to know how your user is behaving on the page, what he is doing, in addition to access reports and statistics by google analytics. In this talk, I will show how was the evolution of user tracking (using google analytics), since the break of Globosat Play monolith and how to track the user across multiple systems without repetitions code, centralizing all the tracking logic in one place, monitoring the events and actions in different project pages (services). It will also be addressed part of validations and tests to ensure the proper functioning of all this metrics.
=========
Com o monitoramento do usuário, você pode saber como o seu usuário está se comportando em sua página, o que ele está fazendo, além de poder gerar relatórios e estatisticas usando google analytics. Nessa palestra, eu vou mostrar a evolução do monitoramento do usuário (usando google analytics), desde a quebra do monolíto do Globosat Play e como monitorar o usuário entre os micro serviços, sem repetição de codigo, centralizando toda a logica em um unico lugar, monitorando os eventos e ações em diferentes páginas (serviços). Vou também abordar parte da validação e testes que garantem o funcionamento dessas métricas.

Published in: Technology
  • Be the first to comment

User Tracking with Google Analytics and how it survives the break of the Globosat Play monolith

  1. 1. USER TRACKING WITH GOOGLE ANALYTICS AND HOW IT SURVIVES THE BREAK OF THE MONOLITH by Rafael Biriba .com
  2. 2. USER TRACKING WITH GOOGLE ANALYTICS AND HOW IT SURVIVES THE BREAK OF THE MONOLITH by Rafael Biriba .com
  3. 3. USER TRACKING WITH GOOGLE ANALYTICS AND HOW IT SURVIVES THE BREAK OF THE MONOLITH by Rafael Biriba .com
  4. 4. USER TRACKING WITH GOOGLE ANALYTICS AND HOW IT SURVIVES THE BREAK OF THE MONOLITH by Rafael Biriba .com
  5. 5. http://talentos.globo.com (Estamos contratando) http://slideshare.net/rafaelbiriba http://rafaelbiriba.comAbout Me
  6. 6. DO YOU KNOW YOUR AUDIENCE ?
  7. 7. WHERE ARE USERS LANDING ?
  8. 8. WHICH LINKS ARE BEING CLICKED?
  9. 9. WHICH LINKS ARE BEING CLICKED?
  10. 10. WHERE DO USERS SPEND TIME ?
  11. 11. WHAT LOGGED-IN USERS ARE DOING ?
  12. 12. WHERE ARE USERS EXITING ?
  13. 13. USER TRACKING
  14. 14. USER TRACKING LOGGING CHARACTERISTICS ABOUT 
 THE USER AND USER'S ACTIONS
  15. 15. USER TRACKING It’s not evil! Mostly. LOGGING CHARACTERISTICS ABOUT 
 THE USER AND USER'S ACTIONS
  16. 16. BUT WHY ? USER TRACKING
  17. 17. USER TRACKING BUT WHY ? ▸ Marketing and business intelligence ▸ Know your audience ▸ Engagement on a feature ▸ App analysis and optimization
  18. 18. THE 5 ”W” USER BEHAVIOUR
  19. 19. USER BEHAVIOUR
  20. 20. USER BEHAVIOUR WHO ▸ Know your user ▸ By individual ▸ By demographic ▸ By a delimiter
  21. 21. USER BEHAVIOUR WHAT ▸ Connect with WHO ▸ Know what your user is doing ▸ By individual ▸ By demographic ▸ By a delimiter ▸ Engagement ▸ Ways people use your app
  22. 22. USER BEHAVIOUR WHERE ▸ Where does your user most utilize your app ? ▸ Location - What state/cities is your app most popular ▸ Devices - What is the most popular device
 ▸ Focus marketing/advertising efforts
  23. 23. USER BEHAVIOUR WHEN ▸ When is your user in your app ▸ Track time, dates, season, moments
 ▸ Release upgrades in low-impact moments
 ▸ Focus marketing/advertising efforts
  24. 24. USER BEHAVIOUR WHY ▸ Subjective to each app/goal ▸ Results ▸ Track targeted objectives with goals ▸ Align app goals with user action’s
  25. 25. USER BEHAVIOUR SO… WHAT SHOULD WE TRACK ?
  26. 26. TRACK EVERYTHING!
  27. 27. MOST POPULAR TRACKING APPLICATIONS / SERVICES 1. HOST YOUR OWN APP
 
 
 2. SAAS SOLUTION
  28. 28. 1. HOST YOUR OWN APP OPEN WEB ANALYTICS ▸ www.openwebanalytics.com ▸ Open Source ▸ Data ownership (privacy) ▸ Clone of Google Analytics
  29. 29. PIWIK ▸ www.piwik.org ▸ Open Source ▸ Data ownership (privacy) 1. HOST YOUR OWN APP
  30. 30. 2. SAAS SOLUTION CLICKY ▸ www.clicky.com ▸ “More feature than 
 Google Analytics” ▸ Layout “confused"
  31. 31. GOOGLE ANALYTICS ▸ www.google.com/analytics/ ▸ It’s Google ▸ Real-Time Rocks 2. SAAS SOLUTION
  32. 32. SAAS SOLUTION GOOGLE ANALYTICS ▸ www.google.com/analytics/ ▸ It’s Google ▸ Real-Time Rocks
  33. 33. SAAS SOLUTION GOOGLE ANALYTICS ▸ www.google.com/analytics/ ▸ It’s Google ▸ Real-Time Rocks CASE
  34. 34. GOOGLE ANALYTICS USER TRACKING +
  35. 35. GOOGLE ANALYTICS IN PRACTICE ▸ Increase of audience
  36. 36. ▸ Increase of audience GOOGLE ANALYTICS IN PRACTICE
  37. 37. ▸ Track watched movies GOOGLE ANALYTICS IN PRACTICE
  38. 38. ▸ Track watched movies GOOGLE ANALYTICS IN PRACTICE SAMPLE:
 119 VIDEO PLAYS
 
 ONLY 93 KEEP WATCHING AFTER 20 SECONDS
  39. 39. GOOGLE ANALYTICS IN PRACTICE
  40. 40. GOOGLE ANALYTICS WORKFLOW
  41. 41. GOOGLE ANALYTICS WORKFLOW Unique Visitors / Users Visits / Sessions Pageviews Volume of available data IncreasingValueofData
  42. 42. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews __utma - Visitor Identifier (expires after 2 years)
 
 
 
 
 __utmb - Session Identifier 
 (expires after 30 minutes of inactivity)
 
 __utmc - Session Identifier
 (expires when close tab/browser)
  43. 43. GOOGLE ANALYTICS WORKFLOW Users __utma cookie explained: 123456789.123456789.1234567890.1234567890.1234567980.1 Domain Hash: This is set by all cookies from this domain.
 Visitor ID: Random “unique ID”.
 Initial visit: Unix timestamp for the initial visit.
 Previous Session: Unix timestamp for the previous session.
 Current Session: Unix timestamp for the current session.
 Session number: Number of the session
  44. 44. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews Moment 1 Moment 2
  45. 45. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews Moment 1 Moment 2
  46. 46. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 1 1 Moment 1 Moment 2
  47. 47. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 1 1 Moment 1 Moment 2
  48. 48. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 1 12 Moment 1 Moment 2
  49. 49. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 1 12 Moment 1 Moment 2
  50. 50. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 1 12 Moment 1 Moment 2
  51. 51. GOOGLE ANALYTICS WORKFLOW Users Visits / Sessions Pageviews 1 12 123 Moment 1 Moment 2
  52. 52. GOOGLE ANALYTICS WORKFLOW
  53. 53. GOOGLE ANALYTICS WORKFLOW + As easy as….
  54. 54. GOOGLE ANALYTICS WORKFLOW + As easy as….
  55. 55. GOOGLE ANALYTICS WORKFLOW
  56. 56. GOOGLE ANALYTICS WORKFLOW
  57. 57. GOOGLE ANALYTICS WORKFLOW ▸ Page Tracking: ga(“send", “pageview”) ▸ Track everything about the page access ▸ Who, What, When, Where
  58. 58. GOOGLE ANALYTICS WORKFLOW ▸ Page Tracking: ga(“send", “pageview”) ▸ Track everything about the page access ▸ Who, What, When, Where
 ▸ Event Tracking: ga('send', 'event', 'eventCategory', 'eventAction', ‘eventLabel'); ▸ User interactions with the page content
  59. 59. GOOGLE ANALYTICS WORKFLOW ▸ Page Tracking: ga(“send", “pageview”) ▸ Track everything about the page access ▸ Who, What, When, Where
 ▸ Event Tracking: ga('send', 'event', 'eventCategory', 'eventAction', ‘eventLabel'); ▸ User interactions with the page content
  60. 60. GOOGLE ANALYTICS WORKFLOW ▸ Page Tracking: ga(“send", “pageview”) ▸ Track everything about the page access ▸ Who, What, When, Where
 ▸ Event Tracking: ga('send', 'event', 'eventCategory', 'eventAction', ‘eventLabel'); ▸ User interactions with the page content
  61. 61. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions
  62. 62. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions ▸ App / Screen Tracking
  63. 63. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions ▸ App / Screen Tracking ▸ User Timings
  64. 64. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions ▸ App / Screen Tracking ▸ User Timings ▸ Exception Tracking
  65. 65. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions ▸ App / Screen Tracking ▸ User Timings ▸ Exception Tracking ▸ Custom Dimensions
  66. 66. GOOGLE ANALYTICS WORKFLOW ▸ And more… ▸ Social Interactions ▸ App / Screen Tracking ▸ User Timings ▸ Exception Tracking ▸ Custom Dimensions
  67. 67. GOOGLE ANALYTICS WORKFLOW Simple Summary:
  68. 68. GOOGLE ANALYTICS WORKFLOW Simple Summary:
 
 1. Initialize the analytics.js
  69. 69. GOOGLE ANALYTICS WORKFLOW Simple Summary:
 
 1. Initialize the analytics.js 2. Send Pageview event
  70. 70. GOOGLE ANALYTICS WORKFLOW Simple Summary:
 
 1. Initialize the analytics.js 2. Send Pageview event 3. Track everything with "event tracker"
  71. 71. CASE
  72. 72. Track Events
  73. 73. Track Events
  74. 74. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 

  75. 75. mini iceberg monolith HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 

  76. 76. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 Track Events HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 

  77. 77. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 ga('send', 'event', 'Header', 'Home')
 ga('send', 'event', 'Header', 'Menus')
 ga('send', 'event', 'Header', 'Login')
 ga('send', 'event', 'List', 'Video n') ***
 ga('send', 'event', 'Transmissions', 'Live n') ***
 ga('send', 'event', 'Footer', 'Home')
 ga('send', 'event', 'Footer', 'Menus')
  78. 78. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 $(‘.header .menus’).click(function(){ ga('send', 'event', 'Header', ‘Home'); });
 $(‘.header .home’).click…
 $(‘.header .login’).click…
 $(‘.list .video’).click…
 $(‘.transmissions .video’).click…
 $(‘.footer .home’).click…
 $(‘.footer .menus’).click… JQuery OnClick binds
  79. 79. CASE mini iceberg monolith
  80. 80. micro services - apis, components, libs, small applications CASE mini iceberg monolith
  81. 81. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 
 Components
 
 
 APIs
 
 
 Home APP
 
 
 Live Video APP
  82. 82. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 

  83. 83. HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 

  84. 84. $(‘.header .menus’)
 .click(function(){
 ga('send', ‘event'…
 
 $(‘.header .home’).click…
 $(‘.header .login’).click…
 $(‘.footer .home’).click…
 $(‘.footer .menus’).click… $(‘.list .video’)
 .click(function(){
 ga('send', ‘event'…
 
 $(‘.list .pagination’).click…
 $ (‘.transmissions .video’).click… $(‘.component .video’)
 .click(function(){
 ga('send', ‘event'…
 
 $(‘.component .title’).click…
  85. 85. CASECASE
  86. 86. CASECASE USER TRACKING CODESGOOGLE ANALYTICS CODES APP JSAPP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS
  87. 87. CASECASE USER TRACKING CODESGOOGLE ANALYTICS CODES Responsibility and Ownership separated APP JSAPP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS
  88. 88. CASECASE USER TRACKER JS USER TRACKER JS
  89. 89. `CASECASE USER TRACKER JS ▸ Lib that monitor all user activity and trigger javascript events. ▸ Single and Simple Deployment ▸ Run independent of application JS ▸ Easy to test ▸ Easy to change USER TRACKER JS
  90. 90. USER TRACKER JS HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 

  91. 91. $(‘.header .menus’).click(function(){ ga('send', 'event', 'Header', ‘Home'); });
 $(‘.header .home’).click…
 $(‘.header .login’).click…
 $(‘.list .video’).click…
 $(‘.transmissions .video’).click…
 $(‘.footer .home’).click…
 $(‘.footer .menus’).click… Old way
  92. 92. USER TRACKER JS $(‘.header .menus’).click(function(){
 $(“body”).trigger(“usertracker-header-menus-click”);
 });
 $(‘.list .video’).click(function(){
 $(“body”).trigger(“usertracker-list-video-click”);
 }); 
 $(‘.header .home’).click…
 $(‘.header .login’).click…
 $(‘.list .video’).click…
 $(‘.transmissions .video’).click…
 $(‘.footer .home’).click…
 $(‘.footer .menus’).click…
  93. 93. USER TRACKER JS
  94. 94. USER TRACKER JS user_tracker::player::play
 user_tracker::player::pause
 user_tracker::player::stop
 user_tracker::player::video_playing
 user_tracker::player::after_player_loaded
 
 user_tracker::login::pop_open
 user_tracker::login::click_login::header
 user_tracker::login::click_login::notificacao
 user_tracker::login::click_login::conheca
 
 user_tracker::click_link::destaque_simples
 user_tracker::click_link::conheca_operadora
 user_tracker::click_link::trilho_filmes
  95. 95. USER TRACKER JS bind js events ANY CUSTOM JS $(‘body’).on(“user_tracker::login::pop_open”, function(){
 // Google Analytics push event
 // Do some task
 // Open the window
 });
  96. 96. CASECASE USER TRACKER JS :: TESTS USER TRACKER JS
  97. 97. CASECASE USER TRACKER JS USER TRACKER JS :: TESTS ▸ Jasmine Unit Tests ▸ Smoke tests for QA and PROD environment
  98. 98. GA POWER JS CASECASE GA POWER JS
  99. 99. GA POWER JS CASECASE GA POWER JS ▸ Run independent from the page ▸ Centralizes all interaction with google analytics ▸ Single and Simple Deployment ▸ Easy to test ▸ Easy to change
  100. 100. USER TRACKER JS HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) LIVE TRANSMISSIONS
 
 
 HEADER ( HOME | MENUS | LOGIN ) FOOTER ( HOME | MENUS ) RELATED PROGRAMS
 
 
 GA POWER JS bind js events
  101. 101. $(‘body’).on(“usertracker-header-menus-click”, function(){
 ga('send', 'event', 'Header', 'Menu', 'Click');
 }); $(‘body’).on(“usertracker-list-video-click”, function(){
 ga('send', 'event', 'List', 'Video', 'Click');
 }); 
 $(‘body’).on(“usertracker-header-home-click”, function(){…
 $(‘body’).on(“usertracker-header-login-click”, function(){…
 $(‘body’).on(“usertracker-list-video-click”, function(){…
 $(‘body’).on(“usertracker-transmissions-video-click”, function(){…
 $(‘body’).on(“usertracker-footer-home-click”, function(){…
 $(‘body’).on(“usertracker-footer-home-click”, function(){… GA POWER JS
  102. 102. CASECASE GA POWER JS GA POWER JS :: TESTS
  103. 103. CASECASE GA POWER JS GA POWER JS :: TESTS ▸ Jasmine Unit Tests ▸ Smoke tests for QA and PROD environment ▸ Fake Analytics (More on next slide)
  104. 104. https://github.com/rafaelbiriba/analytics-tester Test suite for Google Analytics that replaces the original ga.js 
 and provide some useful methods for testing purposes. ** Only supports _gaq (old analytics)
 Pull request for the new ga code are welcome :) FAKE ANALYTICS
  105. 105. https://github.com/rafaelbiriba/analytics-tester Just replace the include of http://www.google-analytics.com/ga.js 
 to include the fake ga.js
 
 Any _gaq.push will be stored in a array inside fake ga.
 
 You can access the array and test (with selenium for exemple) if 
 the google command "was called”. FAKE ANALYTICS :: HOW TO USE
  106. 106. CASECASE USER TRACKING CODESGOOGLE ANALYTICS CODES APP JSAPP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS APP JS
  107. 107. QUESTIONS ? http://slideshare.net/rafaelbiriba http://rafaelbiriba.com

×