Google Analytics Social Tracking – Twitter, Facebook, Google Plus & Linkedin

 

In this post you will learn to track Google +1, Facebook Like, Facebook Send, Facebook Unlike, Twitter tweets, Twitter Follows and LinkedIn shares in Google Analytics. But before we move forward, you need to understand the difference between event tracking & social tracking and difference between normal users’ interactions & social interactions:

1. Event tracking is implemented by calling the _trackEvent() method whereas social tracking is implemented by calling the _trackSocial() method.

2. Event reports are available under the ‘Content’ menu and Social reports are available under the ‘Traffic Sources’ menu in your Google Analytics account.

 

The ‘_TrackSocial()’ method

2. To send social interaction data to Google Analytics we call the _trackSocial() method wherever we have added the share button/social plugin:

_gaq.push(['_trackSocial', network, socialAction, opt_target]);

Here,

network => Name of the social network being tracked e.g. Facebook, Twitter, LinkedIn etc. This parameter is required to be passed to the trackSocial method.

socialAction => Type of the social action being tracked e.g. Like, Unlike, Send, Tweet etc. This parameter is required to be passed to the method.

opt_target => This parameter is optional. It is a URL which receives the social action.

Please note: _trackSocial seems to track only those social sharings which were done through social plugin/share button on your website. It doesn’t seem to track re-tweets or sharing done on some third party site or third party plugins like tweetmeme.

So if your blog post is tweeted 10 times via a share button on your website and then later re-tweeted 65 times then also _trackSocial counts only 10 tweets. So in short, i don’t see social interactions being tracked across the web. This is not what i was expecting from Google :(

 

Tracking Google +1 Social interactions

Step-1: Make sure you are using the latest Google Analytics Asynchronous Tracking Code on your website.

Step-2: Copy the Google +1 button code from here and paste it wherever you want to display the button on your website. Google analytics automatically tracks the social interactions associated with Google +1s once you have installed the Google +1 button on your website.  So you don’t need to place any special tracking code for Google +1 button.

Step-3:  After few days/weeks, go to ‘Plugins’ report (under Traffic Sources > Social) in your Google Analytics account. Then click on the primary dimension ‘Social Source and Action’. You will see following report (provided your tracking is set up correctly):

linkedin-share

 

Tracking Facebook Social Interactions

For Facebook, social actions can be: ‘like’,’unlike’, ‘follow’, ‘send’,’comment’ etc.

  • Through ‘like’ button a user can share your web page on his Facebook profile with just one click.
  • Through ‘send’ button a user can send (share) your web page to his friends.
  • Through ‘comment’ button a user can comment on any web page of your website.

Step-1: Make sure you are using the latest Google Analytics Asynchronous Tracking Code on your website.

Step-2: Upload ‘ga_social_tracking.js‘ file to your web server. You can grab this file from here.

Step-3: Enable Social Tracking by adding following code after your Google Analytics Tracking Code and before the </head> tag:

The final code will look like the following:

Don’t copy past this code without modification.

Replace “UA-xxxxxx-x” with your Google Analytics account number and ‘www.your-domain.com’ with your website address where you have installed the ‘ga_social_tracking.js’ file.

Step-4: Install the Facebook ‘like’ button from here. The ‘Like’ button code will look something like this:

Step-5: Add following line of code just before before the <fb:like /> tag:

So the final code will look like this:

Don’t copy-paste this code without modifying it first.

Here The “#appId=xxxxxxxxxxx” is a random app ID that Facebook generates which allows you to access Insights for the button. Don’t use my appID. When you create your own Facebook ‘like’ button,  the Facebook will generate an appId for you. Use that appID.

Note: The appId is not a requirement for the ‘like’ button to work.

Step-6: Copy paste the modified Facebook ‘like’ button code wherever you want to display the Like button.

Step-7: After few days/weeks, go to ‘Plugins’ report (under Traffic Sources > Social) in your Google Analytics account. Then click on the primary dimension ‘Social Source and Action’. You will see following report (provided your tracking is set up correctly):

facebook-like

If you want to track all the social actions provided by Facebook then you need to install all the social plugins of Facebook. You can get the list of such plugins from here.

Note: you can track only those social actions for which you have installed social plugin on your website. For e.g. if you want to track Facebook comments, then you first need to install Facebook comments plugin on your website.

 

Tracking Twitter Social Interactions

For twitter, social actions can be: ‘tweet’, ‘click’, ‘follow’ etc.

Step-1: Make sure you are using the latest Google Analytics Asynchronous Tracking Code on your website.

Step-2: Make sure that the file  ‘ga_social_tracking.js‘ is uploaded on your web server.

Step-3: Make sure you have enabled the Social Tracking as explained above.

Step-4: Install the official twitter button on your website. The ‘twitter’ button code will look something like this:

 Don’t copy past this code without modification. Use your own twitter handle.

Step-5: Copy paste the following code just before the </head> tag:

Step-6: After few days/weeks, go to ‘Plugins’ report (under Traffic Sources > Social) in your Google Analytics account. Then click on the primary dimension ‘Social Source and Action’. You will see following report (provided your tracking is set up correctly):

twitter-interactions

Note: You can’t track twitter social actions through Tweetmeme button or other twitter type buttons.

 

Tracking LinkedIn Social Interactions

Step-1: Make sure you are using the latest Google Analytics Asynchronous Tracking Code on your website.

Step-2: Make sure that the file  ‘ga_social_tracking.js’ is uploaded on your web server. 

Step-3: Make sure you have enabled the Social Tracking as explained above.

Step-4: Add following code after your Social Tracking Code and before the </head> tag:

 The final code will look like the following:

Don’t copy past this code without modification.

Replace “UA-xxxxxx-x” with your Google Analytics account number and ‘www.your-domain.com’ with your website address where you have installed the ‘ga_social_tracking.js’ file.

Step-4:  Install the official linkedin share button on your web page(s). The button code will look like this:

Step-5:  Modify the LinkedIn button code by adding: data-onsuccess="LinkedInShare" like this:

Step-6:  Copy paste the modified button code wherever you want to display the LinkedIn button.

Step-7: After few days/weeks, go to ‘Plugins’ report (under Traffic Sources > Social) in your Google Analytics account. Then click on the primary dimension ‘Social Source and Action’. You will see following report (provided your tracking is set up correctly):

linkedin-share

Related Posts

Join over 4000 subscribers!
Receive an update straight to your inbox every time I publish a new article.

 

About the Author:



My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help. Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from SEO, PPC or Web Analytics.