I created two test pages: one with a Facebook Link button and one with a Link field. When someone clicks “Like”, I want the image pixel to be running, so we can select it from the web server logs.
It works great with the Like button, but for some reason not with the Like drawer. Both Similar plugins are included as versions of XFBML.
The code I use for both when it comes to starting a pixel call:
<div id="fb-root"></div>
<script type="text/javascript">
<!--
window.fbAsyncInit = function()
{
FB.init({
appId: '{{appId}}',
status: true,
cookie: true,
xfbml: true
});
FB.Event.subscribe('edge.create', function(){
var tracking_pixel = new Image(1, 1);
tracking_pixel.src = '{{image_pixel_url}}';
});
};
(function(d){
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.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
I also stated:
<html xmlns:fb="http://ogp.me/ns/fb#">
Any suggestions are welcome!
Thanks in advance.
/ Marcus
source
share