Created
May 17, 2011 04:11
-
-
Save matclayton/975939 to your computer and use it in GitHub Desktop.
Tracking FB social actions
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
<div id="fb-root"></div> | |
<script> | |
(function() { | |
window.fbAsyncInit = function() { | |
FB.Event.subscribe('edge.create', function(response) { | |
_gaq.push(['_trackSocial', 'facebook', 'like', response]); | |
}); | |
FB.Event.subscribe('edge.remove', function(response) { | |
_gaq.push(['_trackSocial', 'facebook', 'unlike', response]); | |
}); | |
}; | |
var e = document.createElement('script'); e.async = true; | |
e.src = document.location.protocol + | |
'//connect.facebook.net/en_US/all.js#xfbml=1'; | |
document.getElementById('fb-root').appendChild(e); | |
}()); | |
</script> |
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
<script> | |
FB.ui({ | |
method: 'apprequests', | |
message: 'You should visit Mixcloud.' | |
}); | |
</script> |
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
<div id="fb-root"></div> | |
<script> | |
(function() { | |
window.fbAsyncInit = function() { | |
FB.Event.subscribe('message.send', function(response) { | |
_gaq.push(['_trackSocial', 'facebook', 'send', response]); | |
}); | |
}; | |
var e = document.createElement('script'); e.async = true; | |
e.src = document.location.protocol + | |
'//connect.facebook.net/en_US/all.js#xfbml=1'; | |
document.getElementById('fb-root').appendChild(e); | |
}()); | |
</script> |
Async FB social buttons + Async Google analytics calls.
FB API sex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Better, more feature-rich custom code snippets to use in place of Facebook's one-line javascript integration examples.