event tracking for google analytics: wordpress edition
Post on 29-Nov-2014
7.445 Views
Preview:
DESCRIPTION
TRANSCRIPT
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)
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
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.
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
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]); });
}
});
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
Event Tracking for Google Analytics: Wordpress Edition
Now Review
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
top related