+ All Categories
Home > Technology > Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Date post: 21-Oct-2014
Category:
View: 339 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
18
Some Advanced Tracking in Google Analytics ...with JavaScript, of course!
Transcript
Page 1: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Some Advanced

Tracking in Google

Analytics

...with JavaScript, of course!

Page 2: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

I’m Nico

I work at SEER Interactive

I do technical analytics implementation

I also run some SEO projects

I like JavaScript & R and a lil’ bit of python

Page 3: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

But Mostly...

I LIKE DATA …and like collecting it

Page 4: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

You need Async or Universal Code

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

Page 5: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Event Tracking

_gaq.push(['_trackEvent',

'Videos',

'Play',

'B-day'

5]);

Google

Documentation:

nnii.co/19QcDBV

Page 6: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Event Tracking

_gaq.push(['_trackEvent',

'Videos', // category

'Play', //action

'B-day' //label

5]); // value

Google

Documentation:

nnii.co/19QcDBV

Page 7: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Custom Variables

Cookie the visitor.

Bucket them based on an

action.

Segment them

Tell me what they do

compared to other people

Page 8: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Custom Variables

_gaq.push(['_setCustomVar',

1,

'Items Removed',

'Yes',

2

]);

Page 9: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Custom Variables

_gaq.push(['_setCustomVar',

1, // slot #1.

Required

'Items Removed', // Category for the user

activity. Required

'Yes', // value of the custom variable.

Required.

2 // Sets the scope to

session-level. Optional

]);

Page 10: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Scope

Page 11: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

3 Cool Things to Track

How do people use your form?

What links are getting clicked on the most?

Are people readers or scanners?

Page 12: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Are people clicking on my links?

You should make sure its getting downloaded,

viewed and visited.

Full post: nnii.co/ext-links-tracking

Post credit: Blast Marketing

$('a').click(function(){

//only external links

_gaq.push(['_trackEvent','Ext-links',

'clicked','External']);

});

Credit: Blast Analytics

Page 13: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

What are people REALLY doing on

this page?

Page 14: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Form Tracker

var array1 = [];

$(document).ready(function () {

$('input').change(function () {

var formbox = $(this).attr('id');

array1.push(formbox);

console.log("you filled out box " + array1);

});

$('#submit').click(function () {

console.log('tracked ' + array1);

alert('this is the order of boxes you filled out: '

+ array1);

//_gaq.push(['_trackEvent', 'Form', 'completed', '"'

+ array1 + '"']);

});

});

JS Fiddle:

nnii.co/js-adv-form-tracker

Page 15: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

Output - Form Tracker

JS Fiddle: nnii.co/js-adv-form-tracker

Page 17: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

What Does This Say?

About 82% that load the article start reading (daily

avg = 82%)

About 55% make it to the bottom of the content

(daily avg = 63%)

About 14% make it to the bottom of the page (daily

avg = 18%)

Page 18: Some Advanced Tracking in Google Analytics in 5 mins - PhillyJS meet up

THANKS!

Have fun with it!

Twitter: @nicomiceli

G+: gplus.to/nicomiceli

Presentation:

nnii.co/js-meetup-track


Recommended