GAS - Google Analytics on Steroids

36
www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential. May 24, 2012 GAS - Google Analytics on Steroids Eduardo Cereto Carvalho 1

description

This was a quick introduction to GAS targeted to non-technical folks for a local meetup group.https://github.com/CardinalPath/gas

Transcript of GAS - Google Analytics on Steroids

Page 1: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

GAS - Google Analytics on Steroids

Eduardo Cereto Carvalho

1

Page 2: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Implementing GA is easy, right?

2

Page 3: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What the basic implementation gives you?

• One pageview every time a page loads

• That doesn’t seem a lot but with just that GA can calculate everything you see on the reports

3

Page 4: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What else could you want?

• E-commerce

• Custom Vars

• Page Interactions ⃪ Events

4

Page 5: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

5

Page 6: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

5

F AI L

Page 7: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to implement Event Tracking?

6

Page 8: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to implement Event Tracking?

6

<a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);">Play</a>

Page 9: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to implement Event Tracking?

6

<a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);">Play</a>

Page 10: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to implement Event Tracking?

6

From: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

<a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);">Play</a>

Page 11: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

The documentation is not perfect

• There’s so much more you can do with events, Video usage is just one small example;

• The docs are just examples, you should never implement events like that in the real world;

• Videos don’t even have a play button most of the time. You probably use a player like youtube.

7

Page 12: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What is GAS

• A library to help you implement GA

• Implement a lot of events so you don’t have to

• Open Source

• Tested on large deployments

• Easy to get involved

• Regular bug-fixes and new features

• Spoiler: I’m the main developer

8

https://github.com/CardinalPath/gas

Page 13: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What GAS gives you for free?• Outbound links

• Web Form usage

• Download links

• Video Usage

• Youtube

• Vimeo

• HTML5 <video />

• Email: links usage

• Scroll percentage

9

Page 14: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Just upload gas.js and implement GAS instead of GA

10

<script type="text/javascript">var _gas = _gas || [];_gas.push(['_setAccount', 'UA-YYYYYY-Y']); // REPLACE WITH YOUR GA NUMBER_gas.push(['_setDomainName', '.mydomain.com']); // REPLACE WITH YOUR DOMAIN_gas.push(['_trackPageview']);_gas.push(['_gasTrackForms']);_gas.push(['_gasTrackOutboundLinks']);_gas.push(['_gasTrackMaxScroll']);_gas.push(['_gasTrackDownloads']);_gas.push(['_gasTrackYoutube']);_gas.push(['_gasTrackVimeo']);_gas.push(['_gasTrackMailto']);

(function() {var ga = document.createElement('script');ga.type = 'text/javascript';ga.async = true;ga.src = '/gas.js';var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga, s);})();</script>

Page 15: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Just upload gas.js and implement GAS instead of GA

10

<script type="text/javascript">var _gas = _gas || [];_gas.push(['_setAccount', 'UA-YYYYYY-Y']); // REPLACE WITH YOUR GA NUMBER_gas.push(['_setDomainName', '.mydomain.com']); // REPLACE WITH YOUR DOMAIN_gas.push(['_trackPageview']);_gas.push(['_gasTrackForms']);_gas.push(['_gasTrackOutboundLinks']);_gas.push(['_gasTrackMaxScroll']);_gas.push(['_gasTrackDownloads']);_gas.push(['_gasTrackYoutube']);_gas.push(['_gasTrackVimeo']);_gas.push(['_gasTrackMailto']);

(function() {var ga = document.createElement('script');ga.type = 'text/javascript';ga.async = true;ga.src = '/gas.js';var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga, s);})();</script>

Page 16: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

11

Page 17: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

11

Success

Page 18: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Events are multidimensional. So you can drill-down into them

12

Page 19: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Events are multidimensional. So you can drill-down into them

12

Page 20: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Events are multidimensional. So you can drill-down into them

12

Page 21: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Events are multidimensional. So you can drill-down into them

12

Page 22: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Videos are even cooler

13

Page 23: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Videos are even cooler

13

Page 24: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

Videos are even cooler

13

Page 25: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

Page 26: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

Page 27: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'myothersite.com']); _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>

Page 28: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'myothersite.com']); _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>

<a href="http://www.myothersite.com/intro"onclick="_gaq.push(['_link', 'http://www.myothersite.com/intro.html']); return false;">See my blog</a>

Page 29: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'myothersite.com']); _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>

<a href="http://www.myothersite.com/intro"onclick="_gaq.push(['_link', 'http://www.myothersite.com/intro.html']); return false;">See my blog</a><a href="http://www.mysite.com/"

onclick="_gaq.push(['_link', 'http://www.mysite.com/']); return false;">Go back to my site</a>

Page 30: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'myothersite.com']); _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>

<a href="http://www.myothersite.com/intro"onclick="_gaq.push(['_link', 'http://www.myothersite.com/intro.html']); return false;">See my blog</a><a href="http://www.mysite.com/"

onclick="_gaq.push(['_link', 'http://www.mysite.com/']); return false;">Go back to my site</a><form name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);">

Page 31: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What do you do if your site has multiple domains?

14

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'mysite.com']); _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>

<script type="text/javascript">

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_setDomainName', 'myothersite.com']); _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>

<a href="http://www.myothersite.com/intro"onclick="_gaq.push(['_link', 'http://www.myothersite.com/intro.html']); return false;">See my blog</a><a href="http://www.mysite.com/"

onclick="_gaq.push(['_link', 'http://www.mysite.com/']); return false;">Go back to my site</a><form name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);">

F AI L

Page 32: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to do it with GAS?

15

_gas.push(['_setAccount', 'UA-XXXXX-1']);_gas.push(['_setAllowLinker', true]);_gas.push(['_setDomainName', 'mysite.com']);_gas.push(['_setDomainName', 'myothersite.com']);_gas.push(['_gasMultiDomain', 'click']);_gas.push(['_trackPageview']);

Page 33: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

How to do it with GAS?

15

_gas.push(['_setAccount', 'UA-XXXXX-1']);_gas.push(['_setAllowLinker', true]);_gas.push(['_setDomainName', 'mysite.com']);_gas.push(['_setDomainName', 'myothersite.com']);_gas.push(['_gasMultiDomain', 'click']);_gas.push(['_trackPageview']);

Success

Page 34: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

GAS can do a lot more for you

• You can extend GAS by adding plugins

• GAS helps you if you need to use _setAllowAnchor(true)

• GAS fixes bad formatted events for you

• GAS helps you if you want to send data to multiple accounts at the same time

16

Page 35: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

What else can you expect from GAS in the future

• Support for more video players

• Support for tracking social widgets usage

• More customization options if you are a developer

17

Page 36: GAS - Google Analytics on Steroids

www.CardinalPath.com © 2012 Cardinal Path, Inc, All Rights Reserved. Proprietary and Confidential.

May 24, 2012

18

https://github.com/CardinalPath/gas

Eduardo Cereto Carvalho@[email protected]