How To Track On-Site Social Interaction Better Using _Tracksocial

Track more plugins in Google Analytics
Track more plugins in Google Analytics

Google Analytics has had social reports for a while now. The Social report appears among the other Traffic Source reports such as Sources and Search Engine Optimisation. From here you can view Network Referrals, Conversions, Trackbacks and Data Hub Activity from other Data Hub Partners like Disqus and Reddit. These reports simplify tracking the value of social activity and traffic and they start to work as soon as Google Analytics starts to function on the site.

There is another, very useful report that takes a little more to get started with: the Plugin report. This report tracks how and where users interact with social media plugins on the site. Without any further work, this report will only track any Google+ buttons active on the site. To get more from this report, you will need to do a little more work.

Where Being Socially Active is an Event

To add other social plugins to the Plugin report you will need to use a method very much like the one you use to track events. While similar, these actions will not appear as an Event in Google Analytics. They will not show up in the beta Event Real Time report, nor will they appear in the Event report under content. When set up, they will only be used in the Social Plugin report.

There is not a lot of difference between:
_gaq.push(

['_trackSocial', 'Pinterest', 'Article Pin', 'Location']);
and:
_gaq.push(['_trackEvent', 'Social', 'Click', 'Location']);

Google's own documentation and examples covers tracking both Facebook and Twitter very well. The examples given are fully functional and could more or less be implemented as shown. All that is required is a single Javascript file, linked to from the document, and that is it. A little more is involved for some of the other social networks.

As _trackSocial is close to _trackEvent in how it works, it is possible simply to add it to any link-based social sharing widget such as in the example below. While this is easy to implement, it can be time consuming to maintain and possibly even cause some issues down the track.

<a style="display: inline-block; text-indent: -9999px; overflow: hidden; width: 81px; height: 20px; background: url('https://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;" title="Share on Tumblr" onclick="_gaq.push(['_trackSocial', 'Tumblr', 'Share', 'pageURL']);" href="http://www.tumblr.com/share">Share on Tumblr</a>

When onclick isn't Enough

Widgets like those supplied by Linkedin or Pinterest are a little bit different, and clicking to share involves a little more than just a simple link. These kinds of widgets require another approach.

<script src="//platform.linkedin.com/in.js" type="text/javascript">
lang: en_US
</script>
<script type="IN/Share" data-counter="top"></script>

Fortunately a click on a Linkedin widget is still a click, and with a little bit of Javascript it is possible to trigger the right code. One approach is to fire off the tracking code on an action, such as a click, in a certain HTML element, such as an li or div, targeted by class:


$('li.linkedin').click(function() {
_gaq.push(['_trackSocial', 'Linkedin', 'Share', 'PageURL']);
});

There is always more that can be done, and if you can set up Events, there is no reason you cannot take the same techniques and apply those to populating your Social Plugin reports in Google Analytics. Or you can simply set up the above as _trackEvent rather than _trackSocial. Personally I prefer to do a little of both, tracking all clicks on social elements on a site as a single Event category, as well as through Social Plugins. Ultimately how you approach this is determined by the requirements of your reporting and the business. Google Tag Manager and Universal Analytics will change a few things around when implemented, but the above can be implemented easily for 'Classic Analytics'.

About the Author: Anthony Contoleon

Anthony works as an SEM Manager in the tourism and travel industry. Most of his free time is lost to creating comics about the digital industry, writing blog posts and drinking coffee.

Contoleon.com

Additional Posts

Killer Business Email Marketing

Killer Business Email Marketing Tips!

SEO Interview with the CPO of Shopify

How Do You Decide On Your Target Audience (And How Well Do You Know Them)?

In compliance with Ontario’s non-essential business closure our physical offices are closed until further notice. Fortunately our willingness to adopt work from home and the required technology over the past two years has allowed us to continue our operations without impact. For our valued clients and partners you can expect the same great level of service and execution you have become accustomed to.

Many clients/prospects have reached out to us in an effort to introduce new campaigns as quickly as possible. In an effort to help our clients pivot we have increased our campaign build capacity. We are now able to turn new campaigns over in 2-3 business days opposed to the typical 5-7 business day turnaround time. Please note that campaign launch approvals from the vendor side (Google, Bing, Facebook, Instagram etc.) may be delayed as those companies migrate to work from home.

For existing clients please reach out to your account manager with any questions you may have.

For non-clients looking for assistance with new campaigns please Contact Us

Read previous post:
Killer Business Email Marketing
Killer Business Email Marketing Tips!

Get it right and Business Email broadcasting is possibly on of the most successful method of engaging existing and new...Read...

Close