$("document").ready(function(){
FB.Event.subscribe('edge.create', function(href, widget) {
...do something
});
});
the above code track the user LIKE the site, how to track if the user SHARE the site?
Please note that "Share" has been deprecated in favor of the like button (see https://developers.facebook.com/docs/share/). The like button has a "Send" component which is basically the equivalent of Share.
Unfortunately, even Send is known to suffer from the problem you describe: It doesn't generate any sort of confirmation or callback. This problem has been reported to Facebook and you can track the bug report here:
https://developers.facebook.com/bugs/275748669167650
Related
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.
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
I'm a bit confused on how to implement the javascript api on my website. First, I need to create an app from facebook, but are there any settings that I should pay more attention to?
Ultimately, I Just want a like button - but I have elements on the page that will pay attention to the like stats, and would like to subscribe to the Edge.create etc methods.
I have an 'App for websites' created, but I'm running into a few issues: First, my like button doesn't show up at all unless the user is logged in. The second is that I just want it to say 'Greg likes biscuitcleaver.com' (much like it would read if the user liked a facebook page - but instead, when I click the like button it says 'Greg Likes a page on biscuitcleaver.com'
Ultimately, the link that ends up on Facebook should just redirect back to my url that I have registered with the Like button. (oh by the way, the url that's in the like button - does it have to be registered with my app somewhere # developers.facebook.com/apps)?
Thanks!
-Greg
You may have a look at the FB Javascript SDK and its login use case for examples and all the configuration details. Beware that FB has been known to change the behavoir of their SDK, so what's true about it today might not be by short notice.
I have a one site , there I want to place a Facebook share button after the sharing the url or link return back on the site and show the coupon instead of share button.
We are waiting for the answers.
If any one give the right answer or make the script , I will give the some bouns.
From the Facebook official documentation:
http://developers.facebook.com/docs/share/
The Share button has been deprecated in favor of the Like button, and
will no longer be supported. Please use the Like button whenever
possible to drive maximum traffic to your apps.
I don't know specifically how to redirect to your site, however I suggest you to switch to like button in any case
I'm no lawyer, but it appears that forcing a person to share something is not correct
https://www.facebook.com/promotions_guidelines.php
You must not
condition registration or entry upon the user taking any action using
any Facebook features or functionality other than liking a Page,
checking in to a Place, or connecting to your app. For example, you
must not condition registration or entry upon the user liking a Wall
post, or commenting or uploading a photo on a Wall.
You should have your corporate attorney take a look at this before proceeding further with forcing a share.
Like is easy to do and is explicitly permissible. See:
http://developers.facebook.com/docs/reference/plugins/like/
Facebook's sharer.php is no longer deprecated but I suggest you switch to using dialog/feed to steer folks back to your coupon.
<a id='fb-share' style='text-decoration:none;' type='icon_link' onClick="window.open('https://www.facebook.com/dialog/feed?display=popup&app_id=YOUR_APP_ID&link=THE_PAGE_WITH_THE_SHARE_BUTTON?&description=MY_AWESOMENESS&redirect_uri=THE_PAGE_WITH_THE_COUPON&picture=URL_OF_A_PRETTY_IMAGE', 'mywindow', 'toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=580,height=325');
return false;" href="javascript: void(0)">Share on Facebook</a>";
I can not find a TOS violation for offering coupons to those that like or share.
I have put a like button on my web page which is dynamically linked to different Facebook fan pages. I have checked the insights pages of Facebook but it gives an overall count of button clicks from my site. Is there a way to get more detailed information like how many users clicked which Like button?
Facebook documentation mentions a ref tag that can be added to Like button code, however this tag does not show up in insights reports. Also I know I have the chance use JavaScript events to handle reporting personally, but I cannot since I am using iframe version of the button.
Also, is there a way for the Facebook fan page admin (the one that my like button links to) to see that detail exactly? e.g. "xx number of clicks generated with like button from this site (or app--which the like button is tied ?)"
In my opinion, Facebook insights are far from being complete.
If I where you, I would track like events, and visits from like using an analytic tools like Google Analytics. This is what I do for my website, and the website of the company I am working for.
However, Facebook insights can give you complementary metrics (age, gender...).
Regards
Antoine
As Antoine says, you can track your likes with Google Analytics. I don't know about insights though.
Here's more info on how to track likes with GA:
http://www.socialmediaexaminer.com/how-to-track-tweets-facebook-likes-and-more-with-google-analytics/
Use FB.Event.subscribe:
FB.Event.subscribe('edge.create',
function(response) {
alert('You liked the URL: ' + response);
}
);
Why use iframe if it is limiting you from doing what you need to do? Use XFBML or HTML5 versions and use the event handler to do an AJAX call to your server. Kinda like, Dr it hurts when I hit my thumb with a hammer, and the Dr says don't hit your thumb.
On the facebook page,we can click the like button to like the page.
How can we use any api or plugin to realize from other site?
You can not automatically like an object for a user nor can you present like via the APIs. This prevents anyone "secretly" having users like pages / objects.
The solution is to embed a like button to your page and give users a clear reason to use it [sell the benefit of liking your page]. You can run a separate version for individual pages, objects or just an aggregate button for all of your site via the data-href element.
http://developers.facebook.com/docs/reference/plugins/like/
You can check if a user has liked your page using:
FB.api('/me/likes', function(response) {
console.log(response);
});
Loop through the response and look for your page ID.
The open-graph api has now been updated to support creating (and deleting) likes.
See here:
https://developers.facebook.com/docs/opengraph/actions/builtin/likes/