Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Tracking FB social actions
<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>
<script>
FB.ui({
method: 'apprequests',
message: 'You should visit Mixcloud.'
});
</script>
<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>
<script>
FB.ui({
method: 'feed',
message: 'Come checkout Laid back radio',
name: 'Laid Back',
caption: 'on Mixcloud',
description: ‘Laid back is an internet medium...’,
link: 'http://www.mixcloud.com/laidbackradio/’,
picture: 'http://mixcloud.com/lb.jpg',
actions: [
{ name: 'fbrell', link: 'http://fbrell.com/' }
]
},function(response) {
if (response && response.post_id) {
_gaq.push(['_trackSocial', 'facebook', 'share', response]);
}
});
</script>
@mitchf

This comment has been minimized.

Show comment Hide comment
@mitchf

mitchf May 17, 2011

Better, more feature-rich custom code snippets to use in place of Facebook's one-line javascript integration examples.

mitchf commented May 17, 2011

Better, more feature-rich custom code snippets to use in place of Facebook's one-line javascript integration examples.

@taitsmp

This comment has been minimized.

Show comment Hide comment
@taitsmp

taitsmp May 18, 2011

Async FB social buttons + Async Google analytics calls.

taitsmp commented May 18, 2011

Async FB social buttons + Async Google analytics calls.

@arush

This comment has been minimized.

Show comment Hide comment
@arush

arush Nov 9, 2012

FB API sex

arush commented Nov 9, 2012

FB API sex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment