Social Plugin Analytics in Google Analytics

Thursday, July 07, 2011 | 10:59 AM

Labels:

With our recent Social Plugin Analytics launch you now have the ability to analyse how users engage with any social plugin such as Google’s +1 button and Twitter’s Tweet button. Now it’s time for the lowdown on how to set this feature up to work for you. If you are a developer, you should pay particularly close attention.

If you’ve added +1 buttons to your site and your Analytics implementation is up to date, integration is automatic and you should already see data in your account. You can ensure the +1 integration is working by taking some simple steps.

If you want to integrate with other social plugins, like Twitter, we’ve also made it really easy. The latest version of the tracking code has a new _trackSocial method to capture various aspects of a social plugin interaction. Using the async javascript snippet, the easiest way to call this method is to use:

_gaq.push([‘_trackSocial’, socialNetwork, socialAction]);

And if you’re using the traditional snippet you’ll need to use this syntax:

var pageTracker = _gat._createTracker(‘UA-xxxxx-y’);
pageTracker._trackSocial(socialNetwork, socialAction);

You then want to call this method somewhere where you know the social plugin has been clicked on. We’ve included some example on how this work with Twitter’s plugin API as well as Facebook’s plugin API and you can see a working demo here. Sweet!

If you are building an integration for use by several Analytics users we encourage you to use the code for the async snippet for now. Also, to enable the development of integrations such as these we would like to share with our customers that we are working toward better compatibility between the sync and async tags with the goal of enabling calls such as _trackSocial to work for both version with the same syntax.

Finally, if you are a developer of a content management plugin which adds social plugins to websites, or if you build social plugins, we want to work with you! Ideally we’d love for all users of your plugin and Google Analytics to have seamless social analytics. In the developer community spirit we’re giving out free t-shirts to the first 100 developers who integrate a social plugin, or a Content Management plugin that adds social widgets to sites with Google Analytics. Let us know what you’ve done by submitting your plugin here.

UPDATE: 7/8/11 5:30pm PST, corrected references to the social plugin analytics feature.