76
#emetrics @PHILPEARCE New York 26 th 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

Most Advanced GTM Deployment. Ever!

Embed Size (px)

Citation preview

Page 1: Most Advanced GTM Deployment. Ever!

#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

Page 2: Most Advanced GTM Deployment. Ever!

I`m an Analytics Adventurer & Explorer!

I recently did 8 countries in 12 weeks = 4.6 days per country

Page 3: Most Advanced GTM Deployment. Ever!

Agenda 1. Set the scene

– Size – Complexity – Timelines

2. How we got there – Tools – Strategy

3. Conclusion & take always – Checklist / Solution Library

4. Questions

Page 4: Most Advanced GTM Deployment. Ever!

Last week I did a twitter survey….

Page 5: Most Advanced GTM Deployment. Ever!

“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 https://plus.google.com/117298997433687198127/posts/dW5TjdS7XEV https://twitter.com/philpearce/status/779678727861104640

Super Experienced people

Page 6: Most Advanced GTM Deployment. Ever!

AdWords …I have done alot more than 10 GTM & GA Implementations

Page 7: Most Advanced GTM Deployment. Ever!

This is the story of

one such implementation…

Page 8: Most Advanced GTM Deployment. Ever!

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!

Page 9: Most Advanced GTM Deployment. Ever!

Project Complexity

Source: builtwith.com/detailed/behemothclient.com

Over 6+ CMS platforms & multiple analytics solutions!

Page 10: Most Advanced GTM Deployment. Ever!

Project Size

Huge site!

Number of pages indexed on Google

2,680,000 results

350,000 results

Page 11: Most Advanced GTM Deployment. Ever!

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

Page 12: Most Advanced GTM Deployment. Ever!

3 month Deadline…

If missed = financial penalties per task!

Page 13: Most Advanced GTM Deployment. Ever!

In Reality…

Inhouse IT dept slow to respond, thus impossible to enforce the task based fines.

Page 14: Most Advanced GTM Deployment. Ever!

How did we get to the Summit?

And more importantly...

• What went right?

• What went wrong?

Page 15: Most Advanced GTM Deployment. Ever!

The Win was deliver by Technical & Tactical working together!

Business Technical

Page 16: Most Advanced GTM Deployment. Ever!

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 Mistakes Wins Mistakes

Page 17: Most Advanced GTM Deployment. Ever!

Tools

Technical

Page 18: Most Advanced GTM Deployment. Ever!

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

Page 19: Most Advanced GTM Deployment. Ever!

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

Page 21: Most Advanced GTM Deployment. Ever!

GoogleSheet highlighted exclude referrals & missing domains

e.g. paypal.com exclude referral was missing!

Page 22: Most Advanced GTM Deployment. Ever!

PII safeguards

…to prevent GA account deletion!

Page 23: Most Advanced GTM Deployment. Ever!

PII prevention filters PP01a: TidyURL - Replace email with [email protected] (start of string) URL (.*?)(=|%3D)([a-zA-Z0-9_.+\-]+(@|%40)[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+)($|&.+)

Output URL [email protected]$A5

PP01b: TidyURL - Replace email with [email protected] (end of string) URL (.*)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)($|&.+)

Output URL [email protected]$A5

PP02a: Tidy EventLabel - Replace email with [email protected] (start of string) EventLabel (.*?)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)($|&.+)

Output EventLabel [email protected]$A5

PP02b: Tidy EventLabel - Replace email with [email protected] (end of string) EventLabel (.*)(=|%3D)([a-zA-Z0-9_.+-]+(@|%40)[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)($|&.+)

Output EventLabel [email protected]$A5

Page 24: Most Advanced GTM Deployment. Ever!

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

Page 25: Most Advanced GTM Deployment. Ever!

Auto-QA

Page 26: Most Advanced GTM Deployment. Ever!

Auto-QA feedback loop… bit.ly/qatemplate

EventID

(GoogleSheet)

Added to each

GTM tag

GA api

(Googlesheet)

vLookup

(GoogleSheet)

Note: Ensure CustomDimension[20] enabled in GA settings

Page 27: Most Advanced GTM Deployment. Ever!

Auto-QA feedback loop… bit.ly/qatemplate

EventID

(GoogleSheet)

Added to each

GTM tag

GA api

(Googlesheet)

vLookup

(GoogleSheet)

Page 28: Most Advanced GTM Deployment. Ever!

Auto-QA feedback loop… bit.ly/qatemplate

Page 29: Most Advanced GTM Deployment. Ever!

GTM auto-event config file bit.ly/gtmconfig (For any CMS)

Reminder: open the import files in notepad, then find & replace “yourdomain” and “yourdomain\\.com” with YOURDOMAIN before import.

Page 30: Most Advanced GTM Deployment. Ever!

Separate GTM-live & GTM-Dev

Page 31: Most Advanced GTM Deployment. Ever!

1. Server-side switch example

Page 32: Most Advanced GTM Deployment. Ever!

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 === 'staging.behemothclient.com' || myHostname === 'localhost'){

myGTMID = 'GTM-xxx2'; // DEV

}

</script>

<!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-xxx1"

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=

'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer', myGTMID);</script>

<!-- End Google Tag Manager -->

Page 33: Most Advanced GTM Deployment. Ever!

Note: This method can not be used on JSvariables only Custom HTML tags.

3. Tag annotation & Failsafe block

Page 34: Most Advanced GTM Deployment. Ever!

Disable CustomHTML, but allow JS variables. <script>

/* Working example: bit.ly/deadman-switch */

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;

</script>

Page 35: Most Advanced GTM Deployment. Ever!

Local Test Environment "Strawman unit tests"

Page 36: Most Advanced GTM Deployment. Ever!

Local Test Environment

Working Example here: bit.ly/strawman-test2

Click to switch versions

Page 37: Most Advanced GTM Deployment. Ever!

JS error benchmarking period before Custom HTML changes deployed. Note: 10% client-side sampling used on errorTracker

JS error tracking

Page 38: Most Advanced GTM Deployment. Ever!

Tactical (Business)

Business

Page 39: Most Advanced GTM Deployment. Ever!

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

Page 41: Most Advanced GTM Deployment. Ever!

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.

7. Adding FB and Twitter widget tracking

8. Adding App download & Tap to Call auto-event tracking

Split Client dependencies part1

Page 42: Most Advanced GTM Deployment. Ever!

Task list (The "What")

Page 43: Most Advanced GTM Deployment. Ever!

Milestones & Deadline planning (The "When")

bit.ly/ga-timeline2

Page 45: Most Advanced GTM Deployment. Ever!

262 Tags, 255 rules and 107 macros!

Standardise the naming convention for Tags, Triggers, Variables

Page 46: Most Advanced GTM Deployment. Ever!

GA pageview trigger example

Consolidated!

Page 47: Most Advanced GTM Deployment. Ever!

GTM Before vs After

• After (3 months later)

• Before (before work started)

-33% Reduction in Tags

-39% Reduction in Triggers

Page 48: Most Advanced GTM Deployment. Ever!

Problem: Lots of configuration mistakes by client Solution: Manual clean-up by senior analyst

Page 49: Most Advanced GTM Deployment. Ever!

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

Page 50: Most Advanced GTM Deployment. Ever!

Governance: Controlling multiple-user changes...

...whilst plane is in mid-flight!

Page 51: Most Advanced GTM Deployment. Ever!

Risk of accidentally publishing other users changes!

Page 52: Most Advanced GTM Deployment. Ever!

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

[email protected] Administrator manage users edit publish

[email protected] Tester view

[email protected] Administrator manage users view view

[email protected] Administrator manage users view view

[email protected] Tester view view

[email protected] Tester view

When Check-out set to read-only

Page 53: Most Advanced GTM Deployment. Ever!

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

[email protected] Administrator Implementation Specialist manage users edit publish view view

[email protected] Tester Project Manager view

[email protected] Administrator Systems Admin manage users view view view view

[email protected] Administrator Analyst manage users view view publish view

[email protected] Publisher Marketing Manager view view publish

[email protected] Tester Robot Unit Tester view

GTM-xxx1 GTM-xxx2 GTM-zzzz GTM-xxxx

Page 54: Most Advanced GTM Deployment. Ever!

GTM user access audit bit.ly/gtm-access-audit2

Also see David Vallejo`s free API based user-access tool here: www.thyngster.com/gaupet-release-google-analytics-user-permissions-exploring-tool

Page 55: Most Advanced GTM Deployment. Ever!

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)

Page 56: Most Advanced GTM Deployment. Ever!

Unexpected avalanches...

Page 57: Most Advanced GTM Deployment. Ever!

Exceeded monthly hit limit!

Note: Hit Tiers above has changed after this project was completed, so there`s now more granular tiers.

$$$

Page 58: Most Advanced GTM Deployment. Ever!

Solution: renaming universal object “ga” to “ga2”

A/B testing tool was sending GA event hits to all trackers on every page = 3x hits

Page 59: Most Advanced GTM Deployment. Ever!

Moving TMS.js pageview into GTM was delayed due to clients fragmented codebase

WPF 1st pageview script

images.behemothclient.com/wpf/CACHE/js/6f599508e0a4-cb1424263825.js

images.behemothclient.com/wpf/sites/common/j/analytics.js

www-s.behemothclient.com/wpf/sites/common/j/analytics.js

WPF 2nd pageview script on Members section

media-mmdb.behemothclient.com/static-media/js/analytics.js

WPF 3rd pageview script on Gallery buttons

images.behemothclient.com/wpf/sites/common/j/jquery.address-1.3.1-grant.min-cb1299116789.js

WPF 4th event script on Members section

assets.behemothclient.com/behemoth-header/build/lib/analytics.js

Page 60: Most Advanced GTM Deployment. Ever!

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$

Page 61: Most Advanced GTM Deployment. Ever!

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'] );

plus.google.com/117298997433687198127/posts/McER3buexek

Page 62: Most Advanced GTM Deployment. Ever!

https://plus.google.com/117298997433687198127/posts/R5r3Bp88ir7

Creative solution: Enable cross-domain tracking in the Cart funnel without IT dept involvement

Page 63: Most Advanced GTM Deployment. Ever!

Automatic Process Summary (Dec 23rd, 2015)

Page 64: Most Advanced GTM Deployment. Ever!

Project Successes: Phase(s)

Page 65: Most Advanced GTM Deployment. Ever!

Efficiency improvements

• Less time used on client meetings.

• More focused on completing tasks.

Page 66: Most Advanced GTM Deployment. Ever!

However… client slow to action tasks

7 day wait

"Awaiting Agency" tasks very low :)

Page 67: Most Advanced GTM Deployment. Ever!

Training

Page 68: Most Advanced GTM Deployment. Ever!

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

Page 69: Most Advanced GTM Deployment. Ever!

Need to prevent this happening again...

Page 70: Most Advanced GTM Deployment. Ever!

Client Training • analyticsacademy.withgoogle.com/course/5 • cardinalpath.com/training/google-analytics/analytics-301/ • lynda.com/Google-Tag-Manager-training-tutorials/ • measureschool.com/products/

bit.ly/gtmplaylist

Page 71: Most Advanced GTM Deployment. Ever!

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.

Page 72: Most Advanced GTM Deployment. Ever!

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.

8. Taxonomy data sent to enhanced ecommerce was very useful for content analysis.

Page 73: Most Advanced GTM Deployment. Ever!

Checklist of Tools…

Page 74: Most Advanced GTM Deployment. Ever!

Life saving tools bit.ly/gtm-checklist

Technical (Phil) 1. +/-2% migration comparison sheet:

bit.ly/ga-api-example 2. Auto-QA sheet:

bit.ly/qatemplate 3. GTM auto-config file: bit.ly/gtmconfig 4. DEV strawman examples: bit.ly/strawman-test2 5. GTM developer guide: bit.ly/gtmdevguide2

• 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:

bit.ly/ga-planning-chart2 2. Deadline planning sheet:

bit.ly/ga-timeline2 3. GTM user access audit:

bit.ly/gtm-access-audit2 4. GTM audit template:

bit.ly/gtm-audit-template 5. Free GTM Training videos:

bit.ly/gtmplaylist

Page 75: Most Advanced GTM Deployment. Ever!

Thankyou & Questions Phil Pearce Senior Web Analyst and GTM specialist

[email protected]

linkedin.com/in/philpearce

Web

Analytics

Exchange

mentor

750 GA

questions answered Tracking

protection

group

Free Prize for the best question(s).

Page 76: Most Advanced GTM Deployment. Ever!

bit.ly/gtmdevguide2 (free) Prize: GTM developer guide

free!! bit.ly/gtmdevguide2