Espen Espelund
Active member
I'm trying to add Google Analytics new Social Interaction Tracking and need to add some code after FB.init. What would be the best way to do this since the code isn't available from the template files?
HTML:
window.fbAsyncInit = function() {
FB.init({appId: '<APPID>', status: true, cookie: true, xfbml: true});
FB.Event.subscribe("edge.create",function(response) {
if (response.indexOf("facebook.com") > 0) {
_gaq.push(['_trackSocial','facebook','fan',response]);
} else {
_gaq.push(['_trackSocial','facebook','like',response]);
}
});
FB.Event.subscribe("edge.remove",function(response) {
if (response.indexOf("facebook.com") > 0) {
_gaq.push(['_trackSocial','facebook','unfan',response]);
} else {
_gaq.push(['_trackSocial','facebook','unlike',response]);
}
});
FB.Event.subscribe("message.send", function(response) {
_gaq.push(['_trackSocial','facebook','send',response]);
});
};