9
Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Embed Size (px)

DESCRIPTION

This is a slide share from a presentation on Event Tracking for Google Analytics, specifically working with Wordpress however, the same principles could be applied to other website platforms. We have found that using this technique works very well, especially if you have plans on growing your site. Once the code is added, going forward each element you want to track you'll just need to add a title and class to it. We have a full blog post on this that can be read at our site: www.gravitatedesign.com

Citation preview

Page 1: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Page 2: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

A Little Recap: Event Tracking Event tracking is a feature of Google Analytics that allows site owners to trace actions on their site, even when a URL change is not recorded.

Standard GA: _gaq.push([‘_trackEvent’,’Category’,’Action’,’opt_label’,’opt_value’])

Universal: ga(‘send’,’event’,’category’,’action’,’opt_label’, opt_value)

Page 3: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Steps to take: l  Decide what events are to be tracked

l  Categorize these events into similar buckets

l  Write and add code to the site

l  Add class to events to be tracked

To Set Up Event Tracking

Page 4: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Items on site: l  Click to the videos section?

l  Click the form submit button?

l  Click to download a file?

l  How many times social links are clicked?

Step 1: What to Track? For  this  presentation,  let’s  say  you  are  managing  a  medical  website  and  a  Dr.  is  releasing  a  preview  to  his  journal  article.  The  page  includes  a  link  to  videos,  form,  download  link,  and  social  icons.      

Page 5: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Items to categorize: l  For videos, lets call the category ‘Videos’

and the Action ‘Play’

l  For forms lets call the category ‘Forms’ and the Action ‘Completion’

l  For journal downloads lets call the category ‘JournalArticles’ and Action ‘Download’

l  For social links lets call the category “Social” and the Action “View”

Step 2: Categorize

Page 6: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Code to add:

Step 3: Add Code

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>     jQuery(function($){

if  (typeof(_gaq)  !==  'undeFined')  //  Check  if  Google  Analytics  is  Loaded  {        

  //  Video  Tracking  for  Google  Analytics      $('.video-­‐track').click(function(e){_gaq.push(['_trackEvent',  'Videos',  'Play',  'Video_'+$(this).attr('title')+'_'+location.href]);    });      //  Form  Tracking  for  Google  Analytics      $('.form-­‐track).click(function(e){_gaq.push(['_trackEvent',  ’Form',  ’Completions',  'Form_'+$(this).attr('title')+'_'+location.href]);    });      //  Journal  Tracking  for  Google  Analytics      $('.journal-­‐track').click(function(e){_gaq.push(['_trackEvent',  'JournalArticles',  'Download',  'Journal_'+$(this).attr('title')+'_'+location.href]);    });      //  Share  Tracking  for  Google  Analytics      $('.social-­‐track’).click(function(e){_gaq.push(['_trackEvent',  'Social',  ‘View’,  'Social_'+$(this).attr('title')+'_'+location.href]);    });  

  }  

});

Page 7: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

For example: <a title=”Doctor John Doe” class=”journal-track” href=”/john-doe-journal-preview.pdf”>Download John Doe’s preview here</a>

Class to add: l  video-track

l  form-track

l  journalarticle-track

l  Social-track

Step 4: Add Class

Page 8: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

Now Review

Page 9: Event Tracking for Google Analytics: Wordpress Edition

Event Tracking for Google Analytics: Wordpress Edition

From: Gravitate – www.gravitatedesign.com Presented By: Joe Vernon

Read the post at:

www.gravitatedesign.com/event-tracking-google-analytics-wordpress-edition/

The End.

@gravitatedesign @blondejoev