I have a Facebook like button on the top of my page and on every product page. How I can find out, where and who clicked the like button (on which product, or on the top of the page?).
You can't because it's restriction of their privacy policy
I've never done anything like that myself, but it looks like you can use Javascript to fire off an event when a given button is clicked -- so you would assign each button on each page a unique identifier and send that back to the server on click. Relevant bits:
After you have obtained the application id you first of all have to add Facebook’s namespace to your html element on the website you wish to add the “Like” button to:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
Then, on the actual page, you include:
window.fbAsyncInit = function() {
FB.init({appId: 'YOUR_FACEBOOK_APP_ID', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
// Do something, e.g. track the click on the "Like" button here
alert('You just liked '+href);
});
};
The actual post has a bit more detail.
EDIT: As others have mentioned, this only covers which button is clicked, and not who has clicked it. In addition to being technically impossible and in violation of Facebook's privacy policy, tracking individual Facebook users on your site without their explicit permission is an unethical invasion of their privacy. Respect your users.
You cannot know your users' Facebook account, it goes against Facebook's privacy policy.
As for where on the page, use Javascript.
If a user has connected to the application the xfbml like button is configured to, then yes you can collect the information the user has shared with your application. You can not share the analytical type data though. For your use only.
As per http://developers.facebook.com/policy/ art. II sec. 2,3
** Storing and Using Data You Receive From Us**
You will only request the data you need to operate your application.
You may cache data you receive through use of the Facebook API in
order to improve your application’s user experience, but you should
try to keep the data up to date. This permission does not give you any
rights to such data.
But in art. I sec. 7
Special provisions for apps on Pages:
b. When a user visits your Page, if they have not given explicit
permission by authorizing your Facebook app or directly providing
information to your Page, you may only use information obtained
from us and the user's interaction with your Page in connection with
that Page. For example, although you may use aggregate analytics for
your individual Page, you must not combine information from any other
sources to customize the user's experience on your Page and may not
use any information about the user's interaction with your Page in
any other context (such as analytics or customization across other
Pages or websites).
Step 1
Create a Facebook Page, such as http://www.facebook.com/pages/SomethingFacebookUsersLike/
Step 2
Create a custom Facebook Like button configured for the above URL. Place the Like button on your Web page.
Step 3
Create an event handler for when a Facebook user clicks the like button...
FB.Event.subscribe("edge.create", function(targetUrl) {
// When the Facebook Like Button is clicked (Likejacked), kick off
// a request to the server immediately to see who just now "liked" the page.
// That person who clicked the like button is probably the same person.
dojo.xhrGet({
url : server_url + fb_page_id,
handleAs : "json",
load : function(response, ioArgs) {
// response should have the facebook user data
}
});
});
Step 4
Server-side process makes a request for the fan page of the Facebook Page...
https://www.facebook.com/browse/page_fans/?page_id=[insert_facebook_page_id]
Replace the page ID for the Facebook Page in the above URL. On that page, the top most Facebook user listed, which will include a link to their profile, is the person who most recently clicked the Like button. Visit users profile and screen scape whatever information is sought after. This information would include at least their "real name" and Facebook ID.
Longer technical explanation can be found here:
I Know Your Name, and Probably a Whole Lot More (Deanonymization via Likejacking, Followjacking, etc.)
http://blog.whitehatsec.com/i-know-your-name-and-probably-a-whole-lot-more-deanonymization-via-likejacking-followjacking-etc/
Related
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've put a Like Gate on a few of my Facebook Pages and I'm getting a lot of complaints saying that people can't access the content via their mobile device since the mobile version of the facebook website, and the facebook apps for ios/android, don't support tabs on Facebook.
I see there are services out there (I'm not sure how legit they are) that offer a way to create a mobile like gate for your page tab, but I can't find any documentation on how they do it. These services are not suitable for me, because the content on my tab is custom and dynamic.
So, how can I create a interstitial page for a mobile page that requires the visitor to have liked my Page on Facebook before they can proceed? This has to work for new users, as well as existing users who re-visit the tab and without requiring an install to an application.
Thanks!
One approach you can take for a mobile site is to check that the user has liked the page in question via the JS SDK.
If you have a logged-in user to your application, you can Subscribe to the authResponseChange FB event within your JS SDK initialization, or call a function directly to make an API request to verify if the user is a fan of your page.
In your initialization:
FB.init({appId: YOUR_FB_APP_ID_HERE });
window.fbAsyncInit = function() {
// React to a user clicking an on-page Like button:
FB.Event.subscribe("edge.create", verifyUserLikesPage);
}
You can verify that the user likes the appropriate page in the like handler:
function verifyUserLikesPage() {
FB.api("/me/likes/"+FBID_OF_PAGE_TO_ENSURE_THEY_LIKE, function(apiResponse){
if (apiResponse.data && apiResponse.data.length > 0)
// User likes the page. Enabled them to proceed
else
// User does not like the page. Require they click Like.
}
}
More information on the edge.create subscribe via JS available here: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
I tried googling & checking stackoverflow for the possible solution but haven't found any yet, so would like to bring it up here again.
I have a Facebook page, page has multiple tabs, and one of the tab has a Facebook App (accessed only through the tab, redirect the http://apps.facebook.com/myapp to the page tab)
I have some content (say non-fan content) to be displayed to the user before he likes the page.but, I don't have any way to check if the user has liked the page unless he adds the app & fb documentation has stuff that can give me the required like FQL page_fan, url_like, api(/me/likes/FACEBOOK_PAGE_ID) but each one of this needs an accesstoken (which I cannot get before the user adds the app).
some of the posts on stackover flow says that is not possible without getting the user to add the app. but there are apps like static html, static iframe & others which provides this functionality, how ?
Please advise.
Facebook will POST a signed_request to your server when the user opens the page tab.
This is what you get when you parse the signed_request:
{
"algorithm":"HMAC-SHA256",
"issued_at":1309468031,
"page":{
"id":"xxxxxxxxxxxxxxx",
"liked":true,"admin":true
},
"user":{"country":"fr","locale":"en_US","age":{"min":21}
}
The important part is "page.liked" where you see if the user likes the page.
No permissions and no app authorization is needed for this to work.
Search the web about parsing the signed_request in your favorite web programming language i.e. php.
I have implemented the like button on a website. People have liked the website, and I have the option to administer that open graph object. However, on the administration page I see the following notice:
Administer Your Page
This is the administration interface for your
webpage at [...]. You can see Insights and
publish to the users that have liked your webpage. Only the
administrators of the webpage can view this interface, other users are
sent to the webpage.
This is a ghost page, because, as the notice says, only the administrator(s) can see it. I don't want the behavior of users being sent to my website. I want them to be able to stay on Facebook and see this page, just like they would see and interact with another business page.
Is there a tool or a request form to do this kind of migration (i.e. from an open graph page to a normal business page)?
I have researched for about two days for this issue, but I have not found any leads.
According to this help article, you can merge two facebook pages into one. But the constraint is that you can merge to a page with higher likes only, and the page with fewer likes will be removed. I am not sure if it works for ghost pages or not.
Shef, let me try to answer:
if you have an app myapp, that is canvas url https://apps.facebook.com/myapp
then you will have an application profile page: http://www.facebook.com/myapp [*]
So if a search your app from google or facebook, then they come to first this page,
and if they click go to app, they reach to your app.
However if you have just implemented like url: myapp.com/myitem=1
then you will have this "ghost" page. You need this ghost page, because you need somewhere
to administrate your likes
So you are asking a real page instead ghost, well this is hard to implement this request by facebook guys. Because there is like link to refer some url. So there must be some pop up asking user: 'Do you want to follow link or go to business page instead'
[*] username is not available anymore for facebook apps. see How to get name of facebook application page?
You can use the ref parameter while specifying your like button. This ref parameter will be set by Facebook, for all url's/links that appear on Facebook, i.e wherever this like action is displayed with the link to the url liked by the user. So you know when a user visits your page through Facebook. Check the following from this link:
ref - a label for tracking referrals; must be less than 50 characters and can contain alphanumeric characters and some punctuation (currently +/=-.:_). The ref attribute causes two parameters to be added to the referrer URL when a user clicks a link from a stream story about a Like action:
fb_ref - the ref parameter
fb_source - the stream type ('home', 'profile', 'search', 'other') in which the click occurred and the story type ('oneline' or 'multiline'), concatenated with an underscore.
Upon calling your url you can redirect the user to the page on Facebook that you want. Business pages on Facebook have a particular url, of course, and you can easily do the redirect.
I don't think that you have an option to migrate an open graph page to a normal business page. You can however create your page, and give it the same name as your website. The draw back here would be when users like your page on Facebook, you won't be able to accumulate the likes already garnered by your website.
EDIT
Take a look at the like box plugin (Facebook doc here ). It can be used to like pages that are on Facebook itself, from external websites. This way you will be able to accumulate your likes. You can also modify the plugin to look like a like button, not fully but almost. But you still end up creating a new page. And the old likes will not be available.
Trying to track sources of Likes to a Facebook Page. Docs from Facebook say:
ref - a label for tracking referrals; must be less than 50 characters and can contain
alphanumeric characters and some punctuation (currently +/=-.:_). The ref attribute causes
two parameters to be added to the referrer URL when a user clicks a link from a stream story
about a Like action:
fb_ref - the ref parameter
fb_source - the stream type ('home', 'profile', 'search', 'other') in which the click
occurred and the story type ('oneline' or 'multiline'), concatenated with an underscore.
But if you are sending Likes to a Facebook Page - NOT an external website - where can you get this fb_ref data? Appears that it's not available in Insights, and you can't put Google Analytics on a Wall, obviously.
Any insights here?
My understanding is that you would use it as follows:
Jim is logged into your site.
Put a FB like button on a page on your web site. You're generating the page dynamically so you can generate the FB like button dynamically too. Since "Jim" is logged in, you can include "Jim" as the ref in the FB Like button.
Jim, an FB user, LIKES the page, and presses the Like button (that includes the Jim ref).
A link to your web page appears on Jim's FB page and all of his friends see it.
Susan, a FB friend of Jim, sees the "Like" about your website on Jim's wall (it appears in her newsfeed.) Excited about the link, she presses it.
Your website receives an incoming GET request from Susan's browser. It includes the ref=Jim. It also includes the fb_source="profile" This tells your page about the requestor.
Your website now displays the page to Susan. The page (dynamically) includes the greeting "Thanks for being a friend of Jim!" etc. Note, you don't know the requestor is Susan, you only know that the requestor found out about the page via Jim's Like of the page. In order to find out that the person is Susan, you need to get her to signin/signup for your website.
Docs for the extra Get params: see the description of the ref param here
Added
Re: But if you are sending Likes to a Facebook Page - NOT an external website - where can you get this fb_ref data? Appears that it's not available in Insights, and you can't put Google Analytics on a Wall, obviously.
Do you mean that you're creating a Like button for a page on Facebook that is not a FB app? AFAIK you're right, you can't see the ref data. The ref data is made available to the target of the Like.
You could create a simple website page that re-directs to the FB page. You'd then collect ref info before re-directing to the FB page. Your simple re-direct page would be the target of the Like. But you'd have to fake out FB's graph tags--they'd know that the canonical url for the page was fb.com/xyz. May not be possible to direct to your_site.com/fb/xyz.