At the moment, the social tracking feature in GA only supports Facebook, Twitter and Google +1. The Google +1 tracking is already integrated to GA, so you don’t have to add any extra code. This article will show you how to implement the tracking code for Facebook and Twitter.

Assumption

Before we start, I have to assume that you are using the newer asynchronous Google Analytics code on your site. It should look something like this: If not, go to your Google Analytics account, grab the new code and add it to your site.

Adding the tracking script

Download this minify javascript and upload to your server (the original script can be found here). Add the following code to your header file, just before thetag: Replace “url-to-script” to the actual URL where you upload the javascript file.

Adding Facebook Like button tracking code

In your web page, locate the section where you display the Facebook Like button code. It should look something like this: Just below this code, add the following: The complete code should look like this:

Adding Twitter button tracking code

For Twitter’s Tweet button, we need to add a callback function to activate the tracking. All you have to do is to copy/paste the code to yourtag.

Implementing Social Tracking in WordPress

If you are using WordPress, one plugin that you can use to implement the tracking code is Social Media Tracking.

Viewing the Analytics

Log into your Google Analytics account. If you have not switched to the new version, do it now.

Under the “Visitor” section, you should see a “social” link. click the “Engagement” link and you should be able to view your social engagement statistics.

That’s it.