Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Search Marketer's Toolkit for Google Tag Manager and Google Analytics

8 321 vues

Publié le

My slides from the Searchlove Boston conference in May 2016. The presentation covers actionable tips and tricks for working with Google Tag Manager and Google Analytics.

Publié dans : Internet
  • Soyez le premier à commenter

Search Marketer's Toolkit for Google Tag Manager and Google Analytics

  1. 1. Reaktor Mannerheimintie 2 00100, Helsinki Finland tel: +358 9 4152 0200 www.reaktor.com info@reaktor.com Confidential ©2015 Reaktor All rights reserved SEARCH marketer’s toolkitGoogle Tag Manager & Google Analytics Simo Ahava Senior Data Advocate
  2. 2. Simo Ahava Senior Data Advocate, Reaktor Google Developer Expert, Google Analytics Blogger, developer, www.simoahava.com Twitter-er, @SimoAhava Google+:er, +SimoAhava
  3. 3. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Why customize?
  4. 4. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Why customize? Google Analytics is GREAT out-of-the-box, right?
  5. 5. PAGEVIEWS
  6. 6. PAGEVIEWS BOUNCE AND CONVERSION RATE
  7. 7. PAGEVIEWS BOUNCE AND CONVERSION RATE SESSIONS
  8. 8. Google Analytics Session
  9. 9. Google Analytics Session Group of interactions that takes place on a website
  10. 10. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity…
  11. 11. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day…
  12. 12. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes…
  13. 13. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List…
  14. 14. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented…
  15. 15. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly…
  16. 16. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult…
  17. 17. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager…
  18. 18. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager… Except if you’ve implemented THAT incorrectly…
  19. 19. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager… Except if you’ve implemented THAT incorrectly… There’s also the sessionControl parameter…
  20. 20. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager… Except if you’ve implemented THAT incorrectly… There’s also the sessionControl parameter… Lets not forget mobile and single-page apps!
  21. 21. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager… Except if you’ve implemented THAT incorrectly… There’s also the sessionControl parameter… Lets not forget mobile and single-page apps! Who knows what else happens server-side?
  22. 22. Google Analytics Session Group of interactions that takes place on a website That expires after 30 minutes of inactivity… Or at the end of they day… Or when acquisition campaign changes… Unless the referral is in the Referral Exclusion List… Or traffic is cross-domain, and cross-domain tracking is implemented… Unless it’s implemented incorrectly… Which is likely since it’s so !#/%(“% difficult… Unless you’re using Google Tag Manager… Except if you’ve implemented THAT incorrectly… There’s also the sessionControl parameter… Lets not forget mobile and single-page apps! Who knows what else happens server-side? Cookies, localStorage, persistent data stores!?
  23. 23. @SimoAhava from @ReaktorNow | #2015ac | 8–11
  24. 24. @SimoAhava from @ReaktorNow | #2015ac | 8–11 X
  25. 25. All metrics and dimensions used by a platform subscribe to the definitions of said platform! GPeC Summit 11-May-2015 | @SimoAhava
  26. 26. All metrics and dimensions used by a platform subscribe to the definitions of said platform! GPeC Summit 11-May-2015 | @SimoAhava sessionized
  27. 27. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Google Tag Manager
  28. 28. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Google Tag Manager The best only way to deploy Google Analytics tracking
  29. 29. Google Tag Manager Lets you create and deploy tracking
 and measurement scripts with ease.
  30. 30. Google Tag Manager Lets you create and deploy tracking
 and measurement scripts with ease. Facilitates interaction between various
 departments within your organization.
  31. 31. Google Tag Manager Lets you create and deploy tracking
 and measurement scripts with ease. Facilitates interaction between various
 departments within your organization. Allows you to focus your time on analysis
 rather than implementation.
  32. 32. Google Tag Manager https://analyticsacademy.withgoogle.com/course/5
  33. 33. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Tricks and methods
  34. 34. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Tricks and methods …for search marketing via Google Tag Manager…
  35. 35. WHY?
  36. 36. WHY? Scroll% & Read%
  37. 37. WHY? SERP Bounce Time
  38. 38. WHY? Content Funnel
  39. 39. WHY? Article performance
  40. 40. #1: Inject Meta Data Dynamically Into The Page http://goo.gl/PJmQuR
  41. 41. Custom HTML Tag <script> (function() { // The NAME attribute of the meta tag: var name = 'description'; // The CONTENT attribute of the meta tag: var content = 'Simo Ahava's blog provides a unique, understandable, and relatable peek into the digital world.'; var m = document.createElement('meta'); m.name = name; m.content = content; document.head.appendChild(m); })(); </script>
  42. 42. Page View Trigger "Inject the Meta Tag during the page load sequence as soon
 as Google Tag Manager has loaded"
  43. 43. + +
  44. 44. #2: Inject SERP Enrichments Into The Page http://goo.gl/zbTZC9
  45. 45. <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebSite", "url": "http://www.simoahava.com/", "potentialAction": { "@type": "SearchAction", "target": "http://www.simoahava.com/?s={search_term}", "query-input": "required name=search_term" } } </script> Custom HTML Tag
  46. 46. Page View Trigger "Inject the JSON-LD during the page load sequence as soon
 as Google Tag Manager has loaded"
  47. 47. https://developers.google.com/structured-data/
  48. 48. + +
  49. 49. #3: Track Structured Data As Content Attributes
  50. 50. function() { var jsonLd = document.querySelector('script[type*="ld+json"]'); return jsonLd ? JSON.parse(jsonLd.innerHTML) : {}; } Custom JS Variable 1: {{JSON-LD}}
  51. 51. function() { return {{JSON-LD}}.author.name || undefined; } Custom JS Variable 2: {{JSON-LD - author.name}}
  52. 52. function() { return {{JSON-LD}}.datePublished || undefined; } Custom JS Variable 3: {{JSON-LD - datePublished}}
  53. 53. function() { return {{JSON-LD}}.headline || undefined; } Custom JS Variable 4: {{JSON-LD - headline}}
  54. 54. Google Analytics View Settings
  55. 55. Google Tag Manager - Page View Tag
  56. 56. Google Analytics - Site Content - All Pages
  57. 57. #4: Article Attributes As Content Groups http://goo.gl/uQi71z
  58. 58. Custom JS Variable: {{JS - Blog Images}} function() { // Make sure the selector points to your content element var content = document.querySelector('.entry-content'); var imgs = content.querySelectorAll('img').length - 1; if (imgs>20) return '21+'; else if (imgs>15) return '16-20'; else if (imgs>10) return '11-15'; else if (imgs>7) return '8-10'; else if (imgs>5) return '6-7'; else if (imgs>3) return '4-5'; else if (imgs>1) return '2-3'; else if (imgs>0) return '1'; else return '0'; }
  59. 59. Custom JS Variable: {{JS - Blog Length}} function() { // Make sure the selector matches your content element var content = document.querySelector('.entry-content'); var wCount = 0; var cText = content.textContent || content.innerText; cText = cText.replace(/(^s*)|(s*$)/gi,''); cText = cText.replace(/[ ]{2,}/gi,' '); cText = cText.replace(/n /,'n'); wCount = cText.split(' ').length; if (wCount>3000) return '3k+'; else if (wCount>2500) return '2.5k-3k'; else if (wCount>2000) return '2k-2.5k'; else if (wCount>1500) return '1.5k-2k'; else if (wCount>1100) return '1.1k-1.5k'; else if (wCount>800) return '800-1.1k'; else if (wCount>500) return '500-800'; else if (wCount>200) return '200-500'; else return '<200'; }
  60. 60. Custom JS Variable: {{JS - Blog Title Length}} function() { var title = document.title; var wCount; title = title.replace(/(^s*)|(s*$)/gi,''); title = title.replace(/[ ]{2,}/gi,' '); wCount = title.split(' ').length; if (wCount>20) return '21+'; else if (wCount>16) return '17-20'; else if (wCount>12) return '13-16'; else if (wCount>10) return '11-12'; else if (wCount>8) return '9-10'; else if (wCount>6) return '7-8'; else if (wCount>4) return '5-6'; else if (wCount>2) return '3-4'; else return '<3'; }
  61. 61. Page View Tag
  62. 62. Google Analytics - Site Content - All Pages
  63. 63. https://support.google.com/analytics/answer/2853423?hl=en You can create up to five Content Groupings."
  64. 64. https://support.google.com/analytics/answer/2853423?hl=en You can create up to five Content Groupings."
  65. 65. https://support.google.com/analytics/answer/2853423?hl=en You can create up to five Content Groupings."
  66. 66. https://support.google.com/analytics/answer/2853423?hl=en " W You can create up to five Content Groupings.
  67. 67. https://support.google.com/analytics/answer/2853423?hl=en " W T You can create up to five Content Groupings.
  68. 68. https://support.google.com/analytics/answer/2853423?hl=en " W T F You can create up to five Content Groupings.
  69. 69. https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets There is a maximum of 20 Custom
 Dimensions (200 for Premium…)"
  70. 70. #5: Measure SERP Bounce Time http://goo.gl/bnS5Xz
  71. 71. Total SERP Bounces
  72. 72. Total SERP Bounces Average Dwell Time Before Bounce
  73. 73. <script> (function() { var s = document.location.search; var h = document.location.hash; var e = {{Event}}; var n = {{New History Fragment}}; var o = {{Old History Fragment}}; // Only run if the History API is supported if (window.history) { // Create a new history state if the user lands from Google's SERP if (e === 'gtm.js' && document.referrer.indexOf('www.google.') > -1 && s.indexOf('gclid') === -1 && s.indexOf('utm_') === -1 && h !== '#gref') { window.oldFragment = false; window.history.pushState(null,null,'#gref'); } else if (e === 'gtm.js') { window.oldFragment = true; } // When the user tries to return to the SERP using browser back, fire the // Google Analytics timing event, and after it's dispatched, manually // navigate to the previous history entry, i.e. the SERP if (e === 'gtm.historyChange' && n === '' && o === 'gref') { var time = new Date().getTime() - {{DLV - gtm.start}}; if (!window.oldFragment) { dataLayer.push({ 'event' : 'returnToSerp', 'timeToSerp' : time, 'eventCallback' : function() { window.history.go(-1); } }); } else { window.history.go(-1); } } } })(); </script> Custom HTML Tag
  74. 74. Triggers for the Custom HTML Tag + All Pages
  75. 75. Data Layer Variables
  76. 76. Trigger for the Event Tag
  77. 77. Custom JS Variable: {{JS - SERP Time In Seconds}} function() { return {{DLV - timeToSerp}} < 1800000 ? {{DLV - timeToSerp}} / 1000 : undefined; }
  78. 78. GA Admin -> Property Settings -> Custom Definitions -> Custom Metrics
  79. 79. Event Tag
  80. 80. GA View Settings -> Calculated Metrics
  81. 81. Custom Report
  82. 82. Total SERP Bounces
  83. 83. Total SERP Bounces Average Dwell Time Before Bounce
  84. 84. #6: Track Content Engagement http://goo.gl/M2pqgV
  85. 85. x5 x10 x7 x7 x8 x8 x9 Interactive Time = Time when user is actively interacting with the page (keyboard and mouse)
  86. 86. <script> (function() { var startEngage = new Date().getTime(); var timeEngaged = 0; var idleTime = 0; var idle = true; var idleReport = false; var idleTimer, reportTimer; /* Set the user as idle, and calculate the time they were non-idle */ var setIdle = function() { idleTime = new Date().getTime(); timeEngaged += idleTime - startEngage; idle = true; }; /* Reset the 5 second idle timer. If the user was idle, start the non-idle timer */ var pulse = function(evt) { if (idle) { idle = false; startEngage = new Date().getTime(); idleReport = false; } window.clearTimeout(idleTimer); idleTimer = window.setTimeout(setIdle, 5000); }; // Utility function for attaching listeners to the window var addListener = function(evt, cb) { if (window.addEventListener) { window.addEventListener(evt, cb); } else if (window.attachEvent) { window.attachEvent('on' + evt, cb); } }; /* Push an event to dataLayer every 15 seconds unless the user is idle. Also, push an event when the user leaves the page */ var report = function(evt) { if (!idle) { timeEngaged += new Date().getTime() - startEngage; } // Push the payload to dataLayer, and only push valid time values if (!idleReport && timeEngaged > 0 && timeEngaged < 3600000) { window.dataLayer.push({ 'event' : 'nonIdle', 'nonIdleTimeElapsed' : timeEngaged }); } if (idle) { idleReport = true; } // Fix possible beforeunload duplication problem if (evt && evt.type === 'beforeunload') { window.removeEventListener('beforeunload', report); } timeEngaged = 0; startEngage = new Date().getTime(); reportTimer = window.setTimeout(report, 15000); }; addListener('mousedown', pulse); addListener('keydown', pulse); addListener('scroll', pulse); addListener('mousemove', pulse); addListener('beforeunload', report); idleTimer = window.setTimeout(setIdle, 5000); reportTimer = window.setTimeout(report, 15000); })(); </script> Custom HTML Tag
  87. 87. Trigger for the Custom HTML Tag
  88. 88. Data Layer Variable
  89. 89. Custom JS Variable: {{JS - Get Engagement Time In Seconds}} function() { return {{DLV - nonIdleTimeElapsed}} / 1000; }
  90. 90. GA: New Custom Metric
  91. 91. Trigger for the Event Tag
  92. 92. Event Tag
  93. 93. GA: New Calculated Metric
  94. 94. GA: New Custom Report
  95. 95. x5 x10 x7 x7 x8 x8 x9 Interactive Time = Time when user is actively interacting with the page (keyboard and mouse)
  96. 96. #7: Track Content As Ecommerce http://goo.gl/mUfazN
  97. 97. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Data is difficult
  98. 98. @SimoAhava from @ReaktorNow | #SearchLove | 3 May 2016 Data is difficult Data quality is earned, not acquired
  99. 99. simo.ahava@reaktor.com www.simoahava.com Twitter: @SimoAhava Google+: +SimoAhava

×