3

I've created two test pages, one with a Facebook Link button and one with a Link box. When somebody clicks "Like" I want an image pixel to be fired so we can pick this up from the web server logs.

It works just fine with the Like button but for some reason not with the Like box. Both Like plugins are included as XFBML versions.

The code I am using for both when it comes to triggering the 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 have also declared:

<html xmlns:fb="http://ogp.me/ns/fb#">

Any suggestions are appreciated!

Thanks in advance.

/Marcus

Cœur
  • 37,241
  • 25
  • 195
  • 267
Marcus Olsson
  • 31
  • 1
  • 2

0 Answers0