google analytics bag o' tricks

80
Google Analytics Bag o’ Tricks Simo Ahava (NetBooster) – SUPERWEEK 2015

Upload: simo-ahava

Post on 21-Apr-2017

18.351 views

Category:

Data & Analytics


4 download

TRANSCRIPT

Page 1: Google Analytics Bag O' Tricks

Google Analytics Bag o’ Tricks

Simo Ahava (NetBooster) – SUPERWEEK 2015

Page 2: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Simo Ahava | NetBooster

@SimoAhava

http://google.me/+SimoAhava

[email protected]

www.simoahava.com

Page 3: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

My (GA) Developer Philosophy

Page 4: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

If you build it, data will come

Page 5: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Page 6: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

The Web is (inherently) stateless

Page 7: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

User intent is untrackable in the

stateless Web

Page 8: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

The life span of a web pageENTRAN

CE

EXIT

Page 9: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

The life span of a web pageENTRAN

CE

EXIT

Page 10: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

No, browser cookies are not the solution (or

HTML Storage)

Page 11: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

document.cookie = 'returning=true'; document.cookie = 'articlesRead=3';

Page 12: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

They provide you with temporary state only

Page 13: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Google Analytics is stateful

Page 14: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

From https://developers.google.com/analytics/devguides/platform/customdimsmets

Page 15: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Google Analytics is better at pattern-matching than a

browser

Page 16: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

But it requires quality input

Page 17: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

When the stateless and the stateful unite

Meaningful data

Meaningful data

Meaningful data

Page 18: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

How do we find and collect meaningful

data?

Page 19: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

No, how do we ask the right questions?

Page 20: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

When a user doesn’t view a page, is it a Page View?

Page 21: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Surely not?

* Obligatory Conference Presentation Meme

Page 22: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

APIS, WORKERS, LIBRARIES, SPECIFICATIONSECMAScript DOMSettableTokenList Web Audio AutocompleteErrorEvent Animation TimingDOMTokenList DOM Fullscreen Drag and Drop SVG Indexed DB DocumentFragment DOMError File API ChildNode

MediaDOMImplementation Web Sockets and Messaging Event WebGL VisibilityWeb Storage Document EventSource CSS Object Model Comment Web Workers Attr WebRTC Selectors

DocumentType Offline Element CharacterData Browser Canvas EventListener CustomEvent Shadow DOM CloseEvent File System API BroadcastChannel Typed Arrays Pointer Lock Elements

Page 23: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

APIS, WORKERS, LIBRARIES, SPECIFICATIONSECMAScriptDOMSettableTokenList Web Audio AutocompleteErrorEvent Animation TimingDOMTokenList DOM Fullscreen Drag and Drop SVG Indexed DB DocumentFragment DOMError File API ChildNode

MediaDOMImplementation Web Sockets and Messaging Event WebGL Visibility Web Storage Document EventSource CSS Object Model Comment Web Workers Attr WebRTC Selectors

DocumentType Offline Element CharacterData Browser Canvas EventListener CustomEvent Shadow DOM CloseEvent File System API BroadcastChannel Typed Arrays Pointer Lock Elements

Page 24: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PAGE VISIBILITY API

Page 25: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PAGE VISIBILITY API

Visible: document['hidden'] = falseHidden: document['hidden'] = true

Page 26: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PAGE VISIBILITY API

Visible: document['hidden'] = falseHidden: document['hidden'] = true

document.addEventListener('visibilitychange', function() { dataLayer.push({ 'event' : 'visibilityChange' });});

Page 27: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PAGE VISIBILITY API

Meaningful data:

When a page is loaded in hidden state, do not send a Page View.

If the visibility of the page changes from hidden to visible, then

send the Page View.

Page 28: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PAGE VISIBILITY API

Page 29: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

DETAILED GUIDE

http://goo.gl/DFgxmi

Page 30: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

1. Page is loaded in the browser

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

Page 31: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

2. Is the Visibility API supported?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

Page 32: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

2. Is the Visibility API supported?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…>> >>

Page 33: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

2. Is the Visibility API supported?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

document.addEventListener( 'visibilitychange', function() { dataLayer.push({ 'event' : 'visibility- Change' }); });

Page 34: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

3. Is the page visible?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

Page 35: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

3. Is the page visible?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…>> >>

Page 36: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

3. Is the page visible?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

Page 37: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

4. Is a Visibility Change detected?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…

Page 38: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THE PROCESS

4. Is a Visibility Change detected?

1. Page is loaded in the browser2. Is the Visibility API supported?3. Is the page visible?4. Is a Visibility Change detected?

yes / noFIRE PAGE VIEW

…and remove visibility listener……and end the process…>> >>

Page 39: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

What just happened?

Page 40: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

We made a metric more meaningful

Page 41: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

But it’s only meaningful if the

questions it answers are relevant

Page 42: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

How can we measure content engagement?

Page 43: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Content engagement is notoriously difficult

to track

Page 44: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Adjusted Bounce RateAdjusted

Page 45: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Adjusted Bounce RateAdjusted

Not happy with a metric? Sure! Tweak the data collection. Don’t tackle the real

problem, i.e. your horrible content!

Page 46: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Scroll Tracking

http://cutroni.com/blog/2014/02/12/advanced-content-tracking-with-universal-analytics/

Page 47: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Scroll Tracking

Better, but it isolates the action of reading as the sole qualification of engagement.

Page 48: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Content is to a blog what products are to a

web store

Page 49: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Shopping Reading Behavior

Page 50: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Checkout Behavior Content Engagement

Page 51: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Product Article Performance

Page 52: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Product Content List Performance

Page 53: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Internal Promotions

Page 54: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Step 1: Terminology

Page 55: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Product: A blog articleProduct price: Words in an articleProduct impression: Views of a title or title+ingress in content listsProduct list: Widget / content area where product impressions can be gathered fromProduct list click: Clicks on entries in a product list

Product detail view: Page load of an article pageAdd to cart: First scroll on an article pageCheckout: 1/3, 2/3, and 3/3 scroll depth on an article pagePurchase: 3/3 scroll depth on an article page and minimum of 60 seconds dwell time

Page 56: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Step 2: Data Collection

Page 57: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PRODUCT LISTS

Page 58: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PRODUCT LISTS

Product impression

Product impressionProduct

impressions

Internal promotion

Page 59: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

PRODUCT LISTS

Page 60: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

ARTICLE PAGE

Page 61: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

ARTICLE PAGE: INITIAL PAGE LOAD = PRODUCT DETAIL VIEW

Page 62: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

ARTICLE PAGE: SCROLLING BEGINS = ADD TO CART

Page 63: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

ARTICLE PAGE: SCROLL DEPTH = CHECKOUT

Page 64: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

ARTICLE PAGE: SCROLL DEPTH + DWELL TIME = PURCHASE

Page 65: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

TIPS

1. Use dataLayer, don’t do what I did (DOM scrape)

2. Feel free to leave something out if it isn’t meaningful or doesn’t make sense

3. Design the data collection with analysis in mind – not because it’s fun and cool

4. If using GTM, remember that only the most recent ’ecommerce’ object push is sent with a tag! Always remember to push an ’event’ value with an ’ecommerce’ object push

5. Read Google’s Dev Guide! It’s all in there.

Page 66: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

TIPS

1. Use dataLayer, don’t do what I did (DOM scrape)

2. Feel free to leave something out if it isn’t meaningful or doesn’t make sense

3. Design the data collection with analysis in mind – not because it’s fun and cool

4. If using GTM, remember that only the most recent ’ecommerce’ object push is sent with a tag! Always remember to push an ’event’ value with an ’ecommerce’ object push

5. Read Google’s Dev Guide! It’s all in there.

Page 67: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

TIPS

1. Use dataLayer, don’t do what I did (DOM scrape)

2. Feel free to leave something out if it isn’t meaningful or doesn’t make sense

3. Design the data collection with analysis in mind – not because it’s fun and cool

4. If using GTM, remember that only the most recent ’ecommerce’ object push is sent with a tag! Always remember to push an ’event’ value with an ’ecommerce’ object push

5. Read Google’s Dev Guide! It’s all in there.

Page 68: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

TIPS

1. Use dataLayer, don’t do what I did (DOM scrape)

2. Feel free to leave something out if it isn’t meaningful or doesn’t make sense

3. Design the data collection with analysis in mind – not because it’s fun and cool

4. If using GTM, remember that only the most recent ’ecommerce’ object push is sent with a tag! Always remember to push an ’event’ value with an ’ecommerce’ object push

5. Read Google’s Dev Guide! It’s all in there.

Page 69: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

TIPS

1. Use dataLayer, don’t do what I did (DOM scrape)

2. Feel free to leave something out if it isn’t meaningful or doesn’t make sense

3. Design the data collection with analysis in mind – not because it’s fun and cool

4. If using GTM, remember that only the most recent ’ecommerce’ object push is sent with a tag! Always remember to push an ’event’ value with an ’ecommerce’ object push

5. Read Google’s Dev Guide! It’s all in there.

Page 70: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

FURTHER READING

http://goo.gl/lMWqW8

Page 71: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

FURTHER READING

http://goo.gl/xYNVb3

Page 72: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

FURTHER READING

http://enhancedecommerce.appspot.com/

Page 73: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

FURTHER READING

https://github.com/sahava/eec-gtm

Page 74: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

Learning & Doing

Page 75: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

JAVASCRIPT

http://www.codecademy.com/en/tracks/javascript

Page 76: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

JAVASCRIPT

Nicholas Zakas: Professional JavaScript For Web Developers (3rd Edition)

Page 77: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

JAVASCRIPT

Cody Lindley: DOM Enlightenment

Page 78: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

JAVASCRIPT

Douglas Crockford: JavaScript: The Good Parts

Page 79: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

HTML5

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5

Page 80: Google Analytics Bag O' Tricks

SUPERWEEK 2015 | #SPWK | @SimoAhava

THANK YOU

@SimoAhava

http://google.me/+SimoAhava

[email protected]

www.simoahava.com