Created
January 30, 2013 10:14
-
-
Save boffey/4672188 to your computer and use it in GitHub Desktop.
Facebook Like Tracking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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