Digital Amber Blog - Web Design, SEO

Thursday, 18 August 2011

Social media tracking like Facebook in Google Analytics

Google Analytics does not enable social tracking by default (apart from +1 social interaction). It is however relatively easy to enable this functionality and benefit from these statistic information.

To get social interaction Analytics and reporting for other networks like Facebook or Twitter, you need to integrate Google Analytics with each network button.The best method to use for that purpose is _trackSocial:


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

Facebook Likes

To record Likes with Google Analytics, subscribe to Facebook's edge.create event and create a callback function to execute the Google Analytics tracking code.

FB.Event.subscribe('edge.create', function(targetUrl) {
  _gaq
.push(['_trackSocial', 'facebook', 'like', targetUrl]);
});

When a user Likes your page, the callback function is executed and receives the URL of the resource being liked. The resource is then passed as a value to the _trackSocial method so Google Analytics can report on the network, action and URL being liked.
 
Read the full story about Social tracking in Google Analytics

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home


 

web design, seo, web development