3 Simple Steps to Track Share Buttons in Google Analytics
Event Tracking is one of the most powerful tracking possibilities in Google Analytics to track the virality of what you produce on your website, blog or web project. With even tracking you can simulate page views in flash files so that you can see the interactivity between your user and your flash file. With Event Tracking you can track clicks on buttons, how long it takes to load a certain element, or as in this example how many people shares your material on social platforms/subscribe to your RSS.
The implementation requires that you have an account on Google Analytics and that you have implemented the ga.js script instead of the legacy urchin.js script in the bottom of your pages.
1. Adding the tracking code
To each of the events you would like to track you should add the following code. (For flash you need to do it a bit differently, but I’ll cover that if you want in later stories.)
onClick=”pageTracker._trackEvent(‘category’, ‘action’, ‘optional label’);”
in a link
<a href=”http://jesperastrom.com” onClick=”pageTracker._trackEvent(‘category’, ‘action’, ‘optional label’);”>Anchor Text</a>
You can choose any type of category, action or optional label that you want. You don’t have to choose a label really, but I find it useful. In this example I set category to what type of button they are clicking. I set action to the type of sharing the button represents and I set the optional label as a dynamic label for the page name.
As I am running a wordpress blogg the following code is the result:
onClick=”pageTracker._trackEvent(‘Subscribe’, ‘RSS’, ‘<?php the_title(); ?>’);”
But you can easily exchange, remove etc. the last part of that code to represent some other label you want to put on that specific action. You can also add a fourth element to your set of data points which is an integer rather than a string. This integer represents the value for load time it takes to perform the requested action. Your code for such an implementation, possibly best used with play, pause, stop buttons for video, is as follows:
onClick=”pageTracker._trackEvent(‘Subscribe’, ‘RSS’, ‘<?php the_title(); ?>’, downloadTime );”
If you choose to set up a tracker for downloads, movie plays, success events such as register buttons or clicks to check out pages (to compare to actual check outs if you have some unexplained drop off), then this works as well. Just change the category and action name to logical labels so that you can find the data in an easy way when you look in your reports.
2. Finding your events
There is an easy way to find the data for the events. Just wait about 24 hrs and a new tab will appear under your Content tab in the left navigation of your Google Analytics account.
Click the Event tracking tab and it will fold out so that you can see the options within it.
Click around and you’ll find the different things sorted under each category.
3. Setting up a Custom Report
In my other post about Custom Reports in Google Analytics I showed you where to find the custom reports and how to create them. To simplify the drilldown of collected data I like to set one up for this occation. To see how I do that I recommend you to watch the video tutorial below that is also available on my YouTube account.
Possibly related posts:
- Related posts on Event Tracking
- Review of 2009 Hotel Tech News | Jon Inge
- Event Tracking using Google Analytics
- Related posts on Google Analytics
- Adding Google Analytics to your website « Reading Tea Leaves by …
- Internet Marketing Ideas | Advanced Web Metrics with Google Analytics
- Related posts on Google Analytics Event Tracking
- Using Jquery and Google Analytics events to track form abandonment.
- OnCars.com Delivers More Than 33 Million Video Views in 2009 …


Tweets that mention 3 Simple Steps to Track Share Buttons in Google Analytics -- Topsy.com
January 17, 2010 at 6:21 pm Tweets that mention 3 Simple Steps to Track Share Buttons in Google Analytics -- Topsy.comWebbstrategi.se - Läsvärt 18 January - Webbstrategi.se
January 18, 2010 at 1:09 pm Webbstrategi.se - Läsvärt 18 January - Webbstrategi.seHomework Tips!
January 19, 2010 at 11:05 am Homework Tips!James Royal-Lawson
January 23, 2010 at 6:51 pm James Royal-LawsonJesper Astrom
January 23, 2010 at 10:40 pm Jesper AstromChris Leone
February 4, 2010 at 12:29 am Chris LeoneJesper Astrom
February 4, 2010 at 10:51 am Jesper AstromChris Leone
February 4, 2010 at 3:09 pm Chris LeoneVilka sociala knappar klickar vi på? | Joinsimon.se
February 24, 2010 at 1:14 pm Vilka sociala knappar klickar vi på? | Joinsimon.seNicklas Larenholtz
February 27, 2010 at 2:37 pm Nicklas LarenholtzJesper Astrom
February 28, 2010 at 12:03 am Jesper AstromJohn Hoff - WP Blog Host
March 2, 2010 at 5:24 pm John Hoff - WP Blog HostJesper Astrom
March 2, 2010 at 11:11 pm Jesper AstromJohn Hoff - WP Blog Host
March 3, 2010 at 12:03 am John Hoff - WP Blog HostJesper Astrom
March 3, 2010 at 6:51 am Jesper AstromJohn Hoff - WP Blog Host
March 4, 2010 at 7:34 am John Hoff - WP Blog HostAnders Ronnau
June 22, 2010 at 9:40 am Anders RonnauJesper Astrom
June 22, 2010 at 6:00 pm Jesper AstromAnders Ronnau
June 23, 2010 at 8:02 am Anders RonnauJanne Lauding
October 27, 2010 at 12:34 pm Janne LaudingJanne Lauding
October 27, 2010 at 1:11 pm Janne LaudingJesper Astrom
October 27, 2010 at 1:56 pm Jesper AstromHOW TO: Re-package Your Best Content for More Exposure (and Links)
January 21, 2011 at 5:45 pm HOW TO: Re-package Your Best Content for More Exposure (and Links)HOW TO: Re-package Your Best Content for More Exposure (and Links) | Boomeroo Web Resources
February 2, 2011 at 5:04 pm HOW TO: Re-package Your Best Content for More Exposure (and Links) | Boomeroo Web ResourcesM
March 8, 2011 at 7:28 pm MMark Simchock
December 9, 2011 at 1:53 am Mark SimchockFrekklz
December 9, 2011 at 5:24 am FrekklzDigitalCoder
February 13, 2012 at 2:34 pm DigitalCoder