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.

Most Advanced GTM Deployment. Ever!


Published on

Phil recently completed a 400 man-hours GTM project & shares lessons learned. Migrating from GA Classic to Universal on 6 CMS platforms and 600 GA classic events is one thing, but facing a fine if the project is not complete within 3 months ads a touch of spice! Phil cleaned-up 2 years of in-house changes, including changes such as consolidated 74 pageview tags and centralizing 20 tags into easy to mange lookup table.

Phil provides Technical insights for Advanced Implementers, aswell as Tactical insights for project managers & business people on area such as QA automation, mistakes to avoid, process examples & knowledge sharing tips.

- QA tool
- Planning tools
- Free GTM developer guide

Published in: Data & Analytics
  • Thanks, Phil! Really nice presentation!
    Are you sure you want to  Yes  No
    Your message goes here

Most Advanced GTM Deployment. Ever!

  1. 1. #emetrics @PHILPEARCE New York 26th Oct 2016 Learnings from the most Advanced GTM Deployment I have ever done! (On a site with 1 billion hits a month) By Phil Pearce
  2. 2. I`m an Analytics Adventurer & Explorer! I recently did 8 countries in 12 weeks = 4.6 days per country
  3. 3. Agenda 1. Set the scene – Size – Complexity – Timelines 2. How we got there – Tools – Strategy 3. Conclusion & take always – Checklist / Solution Library 4. Questions
  4. 4. Last week I did a twitter survey….
  5. 5. “How many Google Tag Manager installations have YOU done?” 1. Newbie: 1-3 installation 2. Experienced: 4-10 installation 3. Advanced: 10+ installation Survey results Super Experienced people
  6. 6. AdWords…I have done alot more than 10 GTM & GA Implementations
  7. 7. This is the story of one such implementation…
  8. 8. So, a beautiful but HUGE new client just signed! • 400 man-hours GTM project • 600 GA classic events • GA classic to Universal pageview migration • Inhouse TMS.js migration to GTM • 6 CMS platforms • Only 3 months to complete! • Fine per task, if not completed within the timeline!
  9. 9. Project Complexity Source: Over 6+ CMS platforms & multiple analytics solutions!
  10. 10. Project Size Huge site! Number of pages indexed on Google 2,680,000 results 350,000 results
  11. 11. Switch from GA classic to GA universal Migrate existing 200 GA events in GTM Add 400 GA events (auto-events) Move pageview from TMS.js (inhouse TMS) into GTM Preliminary GTM account audit Behemoth Project Timeline to climb the mountain
  12. 12. 3 month Deadline… If missed = financial penalties per task!
  13. 13. In Reality… Inhouse IT dept slow to respond, thus impossible to enforce the task based fines.
  14. 14. How did we get to the Summit? And more importantly... • What went right? • What went wrong?
  15. 15. The Win was deliver by Technical & Tactical working together! BusinessTechnical
  16. 16. Plus lots of Tools & Techniques! Technical (Phil) • Testing Tools • Strawman Test environment • Separate DEV & LIVE environments • Auto-QA • Failsafe deadman switch • Security • Governance of Logins & access levels • Controlling Risk factors Tactical (Agency) • Task prioritisation • Split based on “required client dependencies” • Sorted based on cost vs benefit • Weighted based on strategically important items Wins MistakesWins Mistakes
  17. 17. Tools Technical
  18. 18. GA classic >> GA universal migration comparison +/-2% Pass +2% Fail -10%Compare on: 1. Pageview Then… 2. Sessions Then.. 3. Users Start with • Hostname GA classic pageTracker GA universal secondTracker
  19. 19. GA classic >> GA universal migration comparison +/-2% Pass +2% Fail -10%Compare on: 1. Pageview Then… 2. Sessions Then.. 3. Users GA classic pageTracker GA universal secondTracker Check in this order: 1. Hostname 2. Referral domains 3. ContentGroups 4. Folders 5. URLs
  20. 20. GA classic >> GA universal migration comparison +/-2%
  21. 21. GoogleSheet highlighted exclude referrals & missing domains e.g. exclude referral was missing!
  22. 22. PII safeguards …to prevent GA account deletion!
  23. 23. PII prevention filters PP01a: TidyURL - Replace email with (start of string) URL (.*?)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+)($|&.+) Output URL $$A5 PP01b: TidyURL - Replace email with (end of string) URL (.*)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+)($|&.+) Output URL $$A5 PP02a: Tidy EventLabel - Replace email with (start of string) EventLabel (.*?)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+)($|&.+) Output EventLabel $$A5 PP02b: Tidy EventLabel - Replace email with (end of string) EventLabel (.*)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+)($|&.+) Output EventLabel $$A5
  24. 24. Generic PII exclude params PP_list_lastchecked_2016_10_30, password, password_confirmation, regCode, username, username_confirm, signin[username], signin[runas], signin, sign_in, conf, gpid, obem, inf_contact_key, user_id, userId, username1, frmUsername, nickName, qz_user_name, url_mac, Email, email, mail, MAIL, feedback_email, newEmailAddress, newemailaddress, emailAddress, emailaddress, recipientName, recipientEmail, MMDB_ID, mmdb_id, EMAIL_ID, email_id, email[body], email[subject], interaction[email], interaction[name], CVC_M1RSUBNM, CVC_M1RADDR1, CVC_M1RADDR2, CVC_M1RCITY, CVC_M1RSTATE, CVC_M1RCTRYC, CVC_M1RZIP, CVC_M1REMAIL, CVC_M1RTACCT, MSRSUBNM, MSRADDR1, MSRADDR2, WESCITY, WESSTATE, WESZIP, MSREMAIL, Name, selectedAddress, selectedAddres_0, selectedAddres_1, selectedAddres_2, selectedAddres_3, selectedAddres_4, selectedAddresSize, Address1, Address2, City, State, Zip, zipcode, qz_user_country, state, oauth_token, oauth_verifier, rptregcta, rptregcampaign, nickName, selectedAddress, username1, frmUsername, mac_address
  25. 25. Auto-QA
  26. 26. Auto-QA feedback loop… EventID (GoogleSheet) Added to each GTM tag GA api (Googlesheet) vLookup (GoogleSheet) Note: Ensure CustomDimension[20] enabled in GA settings
  27. 27. Auto-QA feedback loop… EventID (GoogleSheet) Added to each GTM tag GA api (Googlesheet) vLookup (GoogleSheet)
  28. 28. Auto-QA feedback loop…
  29. 29. GTM auto-event config file (For any CMS) Reminder: open the import files in notepad, then find & replace “yourdomain” and “” with YOURDOMAIN before import.
  30. 30. Separate GTM-live & GTM-Dev
  31. 31. 1. Server-side switch example
  32. 32. 2. Client-side switch example <!– Client Side Switch: Google Tag Manager: Output myGTMID --> <script> var myHostname = window.location.hostname; var myGTMID = 'GTM-xxx1'; // LIVE if(myHostname === '' || myHostname === 'localhost'){ myGTMID = 'GTM-xxx2'; // DEV } </script> <!-- Google Tag Manager --> <noscript><iframe src="//" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//'+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer', myGTMID);</script> <!-- End Google Tag Manager -->
  33. 33. Note: This method can not be used on JSvariables only Custom HTML tags. 3. Tag annotation & Failsafe block
  34. 34. Disable CustomHTML, but allow JS variables. <script> /* Working example: */ window.dataLayer = window.dataLayer || []; dataLayer.push({"gtm.whitelist": ["google", "customPixels", "nonGooglePixels", "nonGoogleScripts", "jsm", "flc", "fls", "k"] }); </script> Disable CustomHTML and JS variables (breaks any JS lookup table wildcards) <script> window.dataLayer = window.dataLayer || []; dataLayer.push({"gtm.blacklist": ["customScripts"] }); </script> 4. The Deadman switch example Thankfully this was never used! Note: alternative method for inline method to disable specific script was considered: <script> window.dataLayer = window.dataLayer || []; dataLayer.push({"hasPreventGTMscrollTrackingBeenSet": true}); var hasPreventGTMscrollTrackingBeenSet = true;
  35. 35. Local Test Environment "Strawman unit tests"
  36. 36. Local Test Environment Working Example here: Click to switch versions
  37. 37. JS error benchmarking period before Custom HTML changes deployed. Note: 10% client-side sampling used on errorTracker JS error tracking
  38. 38. Tactical (Business) Business
  39. 39. Project Scope/Tasks Original scope… TMS.js migration UA pageview migrations 400 gtm event migrations 200 inline event migrations - 20 second heartbeat - Scroll tracking - Link Listeners (Outclick, PDF, social) - Videos (2 video players) - Donation ecommerce transactions Added to scope… GTM account clean-up (inc Naming conventions) DEV vs LIVE environments HTML Sandboxes UniversalSecondTracker GA testing profiles SSL tag issues CustomVariables >> CustomDimenssions Subscription Ecommerce tracking Cross-domain tracking
  40. 40. Resource Planning Gantt (The "Who")
  41. 41. No client involvement: GA Settings: 1. Copy the 5 Goals from the TEST profile view to LIVE profile view 2. Create profile view for CART converted and CART non-converted 3. Create profile view for backend rolledup for Apps and Apps for userID 4. Improving organic by 1.5% by updating channel groupibehemoth No client involvement: GTM config 1. Subscription e-commerce tracking via DOM scrapping 2. Enable Donate ecommerce revenue tracking 3. Consolidating 27 remarkting tags into 4 tags. 4. Reviewing & fix the remaining 178 triggers for errors. 5. Enable Adwords Dynamic remarking using lookup tables 6. Reducing self referrals from 1% to 0% by enabling legacyHistoryImport. Split Client dependencies part1
  42. 42. Task list (The "What")
  43. 43. Milestones & Deadline planning (The "When")
  44. 44. Preliminary assessment of Scale of Task… GTM audit:
  45. 45. 262 Tags, 255 rules and 107 macros! Standardise the naming convention for Tags, Triggers, Variables
  46. 46. GA pageview trigger example Consolidated!
  47. 47. GTM Before vs After • After (3 months later) • Before (before work started) -33% Reduction in Tags -39% Reduction in Triggers
  48. 48. Problem: Lots of configuration mistakes by client Solution: Manual clean-up by senior analyst
  49. 49. Solution: Utilise newer feature such as auto-events, lookup tables & tag templates One BIG pile of spaghetti! Inhouse GTM config built-up over a 3 year period with 3+ users
  50. 50. Governance: Controlling multiple-user changes... ...whilst plane is in mid-flight!
  51. 51. Risk of accidentally publishing other users changes!
  52. 52. Multiple users: Check-in/Check-out Solution1: Check-in/Check-out processes and enforce View | Edit access. Email Role Account Permissions 01. LIVE 02 DEV Administrator manage users edit publish Tester view Administrator manage users view view Administrator manage users view view Tester view view Tester view When Check-out set to read-only
  53. 53. Solution2: Create User sandboxes User1 | User2 >> DEV >> LIVE Multiple users: sandboxes Email Role Job title Account Permissions 01. LIVE 02 DEV Marys Sandbox Mathews Sandbox Administrator Implementation Specialist manage users edit publish view view Tester Project Manager view Administrator Systems Admin manage users view view view view Administrator Analyst manage users view view publish view Publisher Marketing Manager view view publish Tester Robot Unit Tester view GTM-xxx1 GTM-xxx2 GTM-zzzz GTM-xxxx
  54. 54. GTM user access audit Also see David Vallejo`s free API based user-access tool here:
  55. 55. Summary of safety features 1. 2 stage authentication 2. PII protection - via GA filter on URI & eventLabel 3. JS error tracking profile 4. Inline switch for GTM-DEV / GTM-LIVE (can be client-side or serverside method) 5. Failsafe/deadman`s switch (dataLayer whitelist)
  56. 56. Unexpected avalanches...
  57. 57. Exceeded monthly hit limit! Note: Hit Tiers above has changed after this project was completed, so there`s now more granular tiers. $$$
  58. 58. Solution: renaming universal object “ga” to “ga2” A/B testing tool was sending GA event hits to all trackers on every page = 3x hits
  59. 59. Moving TMS.js pageview into GTM was delayed due to clients fragmented codebase WPF 1st pageview script WPF 2nd pageview script on Members section WPF 3rd pageview script on Gallery buttons WPF 4th event script on Members section
  60. 60. Deployed via GTM flag... First method not effective as not a common field :( _gaq.push(['_setCustomVar', 5, 'flag', '_gtmDeployed', 3]); ga('secondaryTracker.set', 'dimension20', '_gtmDeployed'); Second method worked a charm! var flag = document.title + '_gtmDeployed'; _gaq.push(['_title', flag ]); ga("secondaryTracker.set", {title: flag}); Note: filter to clean-up the page title was required... PP01a. EXCLUDE hits not deployed via GTM Exclude filter for PageTitle (.*)_gtmDeployed$ PP01b. CLEAN PageTitle PageTitle (.*)_gtmDeployed$ Output PageTitle $A1 PP02. INCLUDE pageview hits only Include hitType=^pageview$
  61. 61. Set utmz cookie - so that inline gaq.push events still work, but don’t effect hitlimit Solution: _initData var _gaq = _gaq || []; _gaq.push( ['_setAccount', 'UA-1-1'], ['_addIgnoredRef', {{Page Hostname}} ], ['_addIgnoredRef', {{Page Hostname - www removed}} ], ['_setDomainName', {{jsm_setTopLevelDomain}} ], ['_setAllowLinker', true], ['_initData'] );
  62. 62. Creative solution: Enable cross-domain tracking in the Cart funnel without IT dept involvement
  63. 63. Automatic Process Summary (Dec 23rd, 2015)
  64. 64. Project Successes: Phase(s)
  65. 65. Efficiency improvements • Less time used on client meetings. • More focused on completing tasks.
  66. 66. However… client slow to action tasks 7 day wait "Awaiting Agency" tasks very low :)
  67. 67. Training
  68. 68. Human Error on import & publish which caused untested & broken version to be accidentally deployed to LIVE! Solution: User training & 2 people used to verify go-live changes. Wrong version accidentally deployed
  69. 69. Need to prevent this happening again...
  70. 70. Client Training • • • •
  71. 71. Project Learnings/Improvements 1. Remove "human factor" (e.g. manual export from DEV to LIV) 2. Auto-QA change to use TagID and auto-detect if new GA event added in GTM. 3. Enforce GTM audit at the beginning (not optional task) 4. Enforce a Project summary and feedback session at the end of every phase (not optional task) 5. Move onto insight, dashboards, A/B testing or BigQuery sooner.
  72. 72. Unexpected wins 1. 1000 tags consolidate to 500 tags reduce gtm.js download size. 2. Reduction in JS errors after TMS.js change to GTM auto-events 3. Much easier to maintain pageview triggers. 4. SSL tag issues fixed 5. Cross-domain tracking was done without IT involvement using JS variable script. 6. VideoProvider tracking was done without IT involvement using DOM scrapping. 7. Ecommerce revenue enabled via DOM scraping.
  73. 73. Checklist of Tools…
  74. 74. Life saving tools Technical (Phil) 1. +/-2% migration comparison sheet: 2. Auto-QA sheet: 3. GTM auto-config file: 4. DEV strawman examples: 5. GTM developer guide: • Script for "Deployed via GTM flag" to find inline GA scripts (without using a crawler) • Script for _initData to sustain gap.push events Tactical (Agency) 1. Resource planning Gantt sheet: 2. Deadline planning sheet: 3. GTM user access audit: 4. GTM audit template: 5. Free GTM Training videos:
  75. 75. Thankyou & Questions Phil Pearce Senior Web Analyst and GTM specialist Web Analytics Exchange mentor 750 GA questions answered Tracking protection group Free Prize for the best question(s).
  76. 76. (free) Prize: GTM developer guide free!!