implemetning google analytics - 2011-09-24 Google Devfest Chiangmai

99
Implementing Google Analytics Vinoaj Vijeyakumaar Senior Conversion Specialist, Google Southeast Asia Chiang Mai, 2011 gplus.to / vinoaj twitter.com/vinoaj #devfestcm conversionroom-japac.blogspot.com

Transcript of implemetning google analytics - 2011-09-24 Google Devfest Chiangmai

Implementing Google Analytics

Vinoaj Vijeyakumaar Senior Conversion Specialist,

Google Southeast Asia

Chiang Mai, 2011

gplus.to/vinoaj twitter.com/vinoaj #devfestcm conversionroom-japac.blogspot.com

2

Why measure? http://www.flickr.com/photos/screenpunk/2787210951/

The Role of the Web Analyst

3 http://www.flickr.com/photos/kire/797533507/sizes/o/in/photostream/

Actionable Insights Reporting

What does “Action” mean?

4

Discovering new opportunities (eg. New markets, hot trends, customer segments)

Improving marketing strategies (eg. New markets, optimise messaging)

Enhancing the user experience (eg. Compelling content, optimal user flows)

Optimisation Maximising reach of your apps and delighting users

Agenda

• How GA Works • Tracking

– Basics –  Event Tracking –  Custom Variables –  Social Interaction Tracking –  Campaign Variables –  Page Load Time Tracking

• Mobile Tracking – WAP –  Android and iOS

• Tracking Other Platforms

How GA Works

google.co.th/analytics

GA Tracking Code (GATC)

Site & Application Reporting

Track Behaviour

10

Entry Exit

Behaviour

Engagement Reports on 125+ standard metrics and dimensions

The GA Async Tracking Code

11

Dynamically load the ga.js tracking library

HTML5: Execute script asynchronously

Look for _gaq stack and execute queued commands

How Google Analytics works

Secure Google Servers

Website Server

5. Call trackPageview() function

6. Read & write cookies

7. Send gif request. Request contains data.

2. Serve page

1. Request--"Show me this webpage"

3. Request: ga.js

4. Serve ga.js

8. Serve gif

User

<html> <head> ... ... </head> <html> ... ...

__utm.gif?utmwv=6.3&utmn=101027544&utmsr=1280x854&utmsc=32-bit&utmul=en&utmje=1&utmjv=1.5&utmfl=7.0 r24&utmdt=My%20Website&utmhn=www.site.com&utmp=/index.html&utmac=UA-51244-4&utmcc=__utma%3D117945243.823564440.1131054947.1131080858.1133834608.4%3B+__utmb%3D117945243%3B+__utmc%3D117945243%3B+__utmz%3D117945243.1131054947.3.2.utmccn%3D%28Spring%20Sale%29%7Cutmcsr%3D%28google%29%7Cutmcmd%3D%28ppc%29% %7Cutmtm%3D%28shoes%29%3B

The __utm.gif hit

__utm.gif?utmwv=6.3&utmn=101027544&utmsr=1280x854&utmsc=32-bit&utmul=en&utmje=1&utmjv=1.5&utmfl=7.0 r24&utmdt=My%20Website&utmhn=www.site.com&utmp=/index.html&utmac=UA-51244-4&utmcc=__utma%3D117945243.823564440.1131054947.1131080858.1133834608.4%3B+__utmb%3D117945243%3B+__utmc%3D117945243%3B+__utmz%3D117945243.1131054947.3.2.utmccn%3D%28Spring%20Sale%29%7Cutmcsr%3D%28google%29%7Cutmcmd%3D%28ppc%29% %7Cutmtm%3D%28shoes%29%3B

Screen Resolution: 1280x854 Screen Colors: 32-bit Browser Language: English(en) Java Enabled? Yes (1) Java Version: 1.5 Flash Version: 7.0r24

Page Title: My Website Hostname: www.site.com Filename: /index.html Google Analytics Account: UA-51244-4 Visits: 4 Campaign: Spring Sale | Google(PPC) | shoes

Raw Data to Reports

14

GATC Basics

Understand the website structure

Single domain

Multiple sub-

domains

Multiple domains

Multiple domains and multiple sub-

domain

• All content on a single domain

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

Simplest GATC Installation

• Content exists on multiple sub-domains on a single top-level domain

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', '.mysite.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

GATC – Multiple Sub-Domains

• Content exists on multiple top-level domains

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', ’none']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

GATC – Multiple Domains

_link()

Update all links between domains to include the _link() method.

<a href=“http://www.mysite-support.com” onclick=“_gaq.push([‘_link’, this.href]);”>Support</a>

• Content exists on multiple sub-domains on multiple top-level domains

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', ’.mysite.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

GATC – Multiple Domains and Sub-Domains

_link()

Update all links between domains to include the _link() method.

Do not change links between sub-domains on the same top-level

domain.

Linking

_link()

When content exists on multiple domains use linking methods to pass cookie information between domains:

•  For HTTP GET include the _link() method. •  Cookie info in URL parameters •  Redirects user to the new URL

<a href=“http://www.example.com” onclick= “_gaq.push([‘_link’, this.href]);”>Example</a>

•  For HTTP POST include the _linkByPost() method. •  Cookie info in action value •  Used for forms and iFrames on other domains

<form action="http://www.shoppingcart.com/form.php" name="f" method="post” onsubmit=”_gaq.push([‘_linkByPost’, this]);"> . . . </form>

SUBMIT

Event Tracking

Event Tracking

• “Traditional” Google Analytics is pageview based

What about the 1-page App/Site?

• Single URL, no page refreshes

Enter Event Tracking

• Track events on your site • Detect events and trigger tracking call

25

_gaq.push(['_trackEvent', category, action, opt_label, opt_value]);

Purpose Example

Group of objects being tracked

'Markers'

Type of user interaction with the object

'Click'

Additional info about the event

'Google Singapore'

Numerical data about the event

1

Example: Tracking Outbound Social Media Links

26

Example: Tracking Outbound Links

YouTube Video Tracking Example

http://vinnysapidemos.googlecode.com/svn/trunk/google/analytics/youtube/js-player-tracking.html

How did visitors interact with my videos? (Action)

Which videos were played? (Label)

Custom Variables

Custom Variables: Extended Measurement Model

32

125+ Metrics and Dimensions + X Custom Variables = Custom Measurement Platform

Entry Exit

Behaviour

Engagement

Custom Variables

_setCustomVar(index, name, value, opt_scope);

•  index – position to store and transmit the variable (1 to 5) • name – variable name (e.g. “member-type”) (case sensitive)

• value – variable value (e.g. “premium”) (case sensitive)

• opt_scope – 1:visitor-level; 2:session-level; 3:page-level (default: 3)

• Note: Length of Name + Value cannot exceed 64 characters

_setCustomVar(1, ‘foo’, ‘bar’, 2);

Visitor Level Custom Variables

• Stays with the visitor across multiple visits to the site

• Cannot store personally identifiable information

_setCustomVar( 1, ‘MembershipLevel’, ‘Platinum’, 1);

Session Level Custom Variables

• Labels a session • Variable is discarded once session ends

_setCustomVar( 3, ‘UsedChatWidget’, ‘true’, 2);

Page Level Custom Variables

• Useful for content grouping • Identify groups of pages according to

attributes other than the page URL

_setCustomVar( 5, ‘Author’, ‘John Jane Doe’, 3);

Social Interaction Tracking

Measure use of social plugins on your website

What is social plugin tracking?

Social plugin tracking in Analytics shows you: •  How social plugins are used

•  Behavior of socially engaged users

•  Comparative performance of different social plugins

•  What content is socially engaging

Setup for +1 button

Setup for the button: None The +1 button on your website is already tracked.

Setup for other networks

• Other social buttons require a small javascript change to your website.

When a social plugin is used call this method: _trackSocial(network, action, target_url);

Copy & paste Twitter & Facebook code

http://code.google.com/apis/analytics/docs/tracking/gaTrackingSocial.html

Google Confidential and Proprietary

Tracking Social Interactions

MilkADeal.com

<!– Email share button: --> <a onclick="showMailer(&#039;Check out MilkADeal for huge discounts in Malaysia! Here is my referral link: http://milkadeal.com/r/&#039;);return false;" href="#"><div id="lnkMail"></div></a> <!– Functions to track email share button usage: --> <script> function showMailer(myBody){ _gaTrack(); $(".winMessage").html(myBody); $("#mailer").modal(); } function _gaTrack() { _gaq.push(['_trackSocial', 'email', 'share']); } </script>

Google Confidential and Proprietary

What value do socially-engaged visitors hold for us?

Google Confidential and Proprietary

Overview of Socially-Engaged Traffic

Google Confidential and Proprietary

Where are the conversions?

Google Confidential and Proprietary

Encourage more email sharing

Campaign Variables

360 Degree Tracking

50

URL Campaign Variables

51

http://www.yoursite.com/landingpage.html?utm_source=yahoo&utm_medium=cpc&utm_campaign=Jan+2011+Campaign&utm_term=my+keyword

http://www.yoursite.com/landingpage.html?utm_source=twitter&utm_medium=tweet&utm_campaign=Jan+03+One+Day+Sale

http://www.yoursite.com/landingpage.html?utm_source=email&utm_medium=link&utm_campaign=Jan+2011+Newsletter

Campaign Variable Basics

The Source is where the visitor was sent from. Examples: google, nytimes.com, facebook.com

The Keyword is the search term that you bid on (search engines only) The Ad Content should indicate the ad name, copy, or other helpful information to identify the type of ad that was clicked.

Required Tags

Optional Tags

The Medium is the channel in which this URL is promoted. Examples: cpc, display, social, organic

The Campaign should either indicate the overarching name for the marketing effort or just the specific ad campaign in which the ad lives.

Android Referral Tracking

53

http://market.android.com/details?id=com.myorg.myapp&referrer=utm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_term%3D%257Bkeyword%257D%26utm_content%3DAd%2520A%26utm_campaign%3DApp%2520Download

http://yoursite.com/yourapp.apk&referrer=utm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_term%3D%257Bkeyword%257D%26utm_content%3DAd%2520A%26utm_campaign%3DApp%2520Download

Example … Social Media

http://www.yoursite.com/landingpage.html? utm_source=twitter& utm_medium=socialmedia& utm_campaign=My+social+campaign

Page Load Times

The Impact of Speed

Tracking setup

<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-XXXXX-X']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>

Tracking setup

<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-XXXXXX']);_gaq.push(['_trackPageview']);_gaq.push(['_trackPageLoadTime']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>

Tracking setup

Hit

Tracking setup

Time: 1.47 sec

Amari.com

Understanding Page Latency

Page Speed Online

pagespeed.googlelabs.com

Page Speed Recommendations

Before & After

Amari Package Selection Page

Original Page

Page Speed Score 62 / 100 First View Load Time 8.739s

Optimizations include: •  Removed whitespace in HTML •  Using minified versions of JS libraries •  Using minified CSS •  Serving optimised images •  Testing serving GZIPped (compressed) content

Before & After

Amari Package Selection Page

Original Page

Optimized Page

% Change

Page Speed Score 62 / 100 67 / 100 5% First View Load Time 8.739s 7.738s 11.5%

Optimizations include: •  Removed whitespace in HTML •  Using minified versions of JS libraries •  Using minified CSS •  Serving optimised images •  Testing serving GZIPped (compressed) content

Mobile Tracking

Mobile Tracking

68

HTML & Applications WAP

iPh

on

e

Win

do

ws

Mo

bil

e

An

dro

id

Bla

ckb

err

y

Pe

arl

&

Cu

rve

http://code.google.com/apis/analytics/docs/tracking/mobileAppsTracking.html

Track Activity to Mobile Websites [link]

Mobile Websites

ü Server-side tracking

ü Track all web-enabled devices (not just JS & cookie capable)

ü Four languages supported: PHP, Perl, JSP, ASP

ü Works just like Analytics on desktop web pages

Copy & Paste Snippets

70

A Quick Look at the PHP Code Snippet

71

Page rendering script

Insert a pixel for tracking

Generate the pixel URL

ga.php

Send the request to GA

Server-to-Server Communications

72

Secure Google Servers Website Server

Request pixel: /ga.php?....

Send request to GA servers

Google Analytics Mobile SDK

Native App Tracking

Unique Users

Pageviews

Events

Ecommerce

Custom Variables

Android Market Referrals

Setting Up A Tracker Object In An Activity

GoogleAnalyticsTracker tracker;onCreate tracker = GoogleAnalyticsTracker.getInstance(); tracker.startNewSession("UA-xxx-y", this);

74

Dispatching Events

Tracked data is queued and dispatched in bundles • Saves battery life • Can track when users are offline

tracker.dispatch();- or -tracker.start("UA-xxx-y", 20, this);

75

Tracking User Preferences

• How does user behavior differ by orientation?

Custom Variables

tracker.setCustomVar(1, “orientation”, “portrait”, 3); Page

tracker.setCustomVar(1, “orientation”, “landscape”, 3);

Reporting on User Preferences

Reporting on User Preferences

Reporting on User Preferences

Reporting on User Preferences

Reporting on User Preferences

Tracking In-App Purchases

• How much revenue does my application generate? • Which products are most popular?

Reporting In App Purchases

Other Platforms

Tracking on Other Platforms

86

Chrome Extensions

•  Load GA within Chrome extension page

Call _trackPageView to measure extension activation

Call _trackEvent to track interactions

Flash / Flex

Track “Pageviews” Track Events

Silverlight

89

Resources

Subscribe for the Latest News

conversionroom-japac.blogspot.com

Subscribe to receive latest articles in your inbox

code.google.com/apis/analytics

Starter Guides

•  Handy Google Analytics Resources: http://cse-sea.blogspot.com/2009/01/handy-google-analytics-resources.html

•  Getting Started is Easy: http://cse-sea.blogspot.com/2009/03/google-analytics-getting-started-is.html

93

ConversionUniversity.com

Your Name Here

Your Name Here

Google Analytics Individual Qualification

Parties Can Verify Your Qualification Online

96

Recap

•  Data is Gold •  Tag & Track

•  GA Tracking Code •  Event Tracking •  Custom Variables •  Social Interaction Tracking •  Campaign Variables •  Page Load Time Tracking

•  Take Action!!

Thank You!

@vinoaj; gplus.to/vinoaj; #devfestcm