How to Enable Google’s Social Interaction Analytics for Your WordPress Site

How to Enable Google’s Social Interaction Analytics for Your WordPress Site

Last month Google announced its Google+ project which seems to be a big hit so far. This is what Google has to say about the purpose of their +1 button and their new Google+ social network:

The +1 button and the Google+ project are both about making it easier to connect with the people you trust online. For the +1 button, that means bringing advice from trusted friends and contacts right into Google search, letting the users who love your web content recommend it at the moment of decision.

Google is now tracking the results of its +1 project and you can now gain access to reports that show you the value +1 buttons bring to your site. These metrics are available to you without making any changes to your tracking code. You do, however, need to have Google Webmaster tools enabled for your site. If you don’t, then follow our handy guide:

The Quick Start Guide to Using Google Webmaster Tools With WordPress

Sign in to Google Analytics and check out your +1 menu, which houses the Search Impact, Activity, and Audience metrics for your website:

Here you’ll get a comprehensive report on how +1‘s affect your organic search traffic, how many times your pages have been +1’d, from buttons both on your site and on other pages (such as Google search), as well as aggregate geographic and demographic information about the Google users who’ve +1’d your pages.

Enable the Social Plugin Analytics in Google Analytics:

The Social Plugin Analytics in Google Analytics allows you to see how users share your content using other buttons besides +1. When enabled, you’ll be able to measure the social sharing actions on your website.

The easiest way is if the WordPress plugin you’re using for social buttons already integrates Googole’s Social Plugin Analytics to automatically record interactions through the buttons. However, if you need to set this up manually, it will vary for each social network and action you want to track.

Google uses the _trackSocial method for getting information about interaction on your website:

_gaq.push([‘_trackSocial’, network, socialAction, opt_target, opt_pagePath]);

Each social network has a different mechanism and you will need to tailor the code above to integrate with the particular API of the social network that you’re wanting to track.

For example, if you’re using Twitter’s official Tweet button, then you may have implemented it similar to this:

< script src="" type="text/javascript" >< /script>
  < a href=""
     class="twitter-share-button">Tweet< /a>

In this instance Google recommends that you bind a callback function to the tweet event, like this:
{code type=javascript}‘tweet’, function(event) {
if (event) {
var targetUrl;
if ( && == ‘IFRAME’) {
targetUrl = extractParamFromUri(, ‘url’);
_gaq.push([‘_trackSocial’, ‘twitter’, ‘tweet’, targetUrl]);

That last bit pulls in all the information that Google needs to track the action on this button.

Here’s another common example. If your site uses the Facebook JavaScript SDK and you want to track Facebook likes, unlikes and sends, here’s an example callback (It’s recommended that you add an optional name for the tracker object and the page url):
{code type=javascript}
_ga.trackFacebook = function(opt_pageUrl, opt_trackerName) {
var trackerName = _ga.buildTrackerName_(opt_trackerName);
try {
if (FB && FB.Event && FB.Event.subscribe) {
FB.Event.subscribe(‘edge.create’, function(targetUrl) {
_gaq.push([trackerName + ‘_trackSocial’, ‘facebook’, ‘like’,
targetUrl, opt_pageUrl]);
FB.Event.subscribe(‘edge.remove’, function(targetUrl) {
_gaq.push([trackerName + ‘_trackSocial’, ‘facebook’, ‘unlike’,
targetUrl, opt_pageUrl]);
FB.Event.subscribe(‘message.send’, function(targetUrl) {
_gaq.push([trackerName + ‘_trackSocial’, ‘facebook’, ‘send’,
targetUrl, opt_pageUrl]);
} catch (e) {}

You can find many more working examples on the sample code page for Google’s Social Plug-in Analytics. There’s also a bunch of demos where you can see how Google has implemented the code.

Once in place, you’ll have access to the following information in your analytics reports:

  • Social Engagement – This report lets you see how site behavior changes for visits that include clicks on +1 buttons or other social actions. It also allows you to determine, for example, whether people who +1 your pages during a visit are likely to spend more time on your site than people who don’t.
  • Social Actions – This report lets you track the number of social actions (+1 clicks, Tweets, etc) taken on your site.
  • Social Pages – This report allows you to compare the pages on your site to see which are driving the highest the number of social actions.

My recommendation is to first check with the plugin developer of your social buttons plugin to see if he has already added Google’s social interaction tracking. If not, then go ahead and add anything you’re interested to track.

This is just the beginning…

Google is just starting out with its plans for social reporting. Expect to see more changes on the horizon and more ways to track user interaction with social networks on your website. After all, the internet is all about connecting with people and finding and sharing information. Adding Google Analytics to WordPress makes it possible to track how well you’re doing on this front.