Question

We want to give our site visitor option to like our Facebook page from our website. However we want to track the "count" of how many like we get from this page. It is indeed our campaign page and we want to track how many visitor we have verus how many like we generate.

I did google and maybe I don't know how to search it, but all I got is general count of like or how to get like button. But my need is little specific, we just need how many like our campaign generate. Period.

Was it helpful?

Solution

You can do some analytics at your end-

The XFBML and HTML5 versions of the button allow you to subscribe to the edge.create event in the Facebook SDK for JavaScript through FB.Event.subscribe. This JavaScript event will fire any time a button is clicked.

edge.create is fired when someone clicks a like button on your page to like something.

edge.remove is fired when someone clicks a like button on your page to unlike something.

Example-

var page_like_or_unlike_callback = function(url, html_element) {
  console.log("page_like_or_unlike_callback");
  console.log(url);
  console.log(html_element);
}

// In your onload handler
FB.Event.subscribe('edge.create', page_like_or_unlike_callback);
FB.Event.subscribe('edge.remove', page_like_or_unlike_callback);

And some other ways mentioned in the FAQ section of the documentation: Like Button

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top