Skip to content

Instantly share code, notes, and snippets.

@boffey
Created January 30, 2013 10:14
Show Gist options
  • Save boffey/4672188 to your computer and use it in GitHub Desktop.
Save boffey/4672188 to your computer and use it in GitHub Desktop.
Facebook Like Tracking
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOURAPPID', // App ID from the App Dashboard
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
FB.Event.subscribe('edge.create', function(response) {
// Track The Like
});
};
(function(d, debug){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ false));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment