Force User To Like FB Page Before Visiting My Website - facebook

As part of a website that I am developing, I have a Like Gate Page that I want to use in order to force my site visitors to press the like button before they are redirected to the site homepage.
When a Liker visitor comes back for the LIKE Gate page he/she should be redirected automatically to the website homepage (he/she already pressed like).
Important:
The whole website including the Like Gate is not found in a Facebook App/Page Tab!
It is OK to ask the user to login before he/she can press the Like button.

Well, in your web page you could implement Facebook login and get user's permission to see his/her likes. Get said likes from Graph API, see if your page is in the list and depending on that, either show your web page, or redirect user to your facebook page. You will need user_likes permission for that.

By using Facebook Javascript SDK Methods FB.Event.subscribe, FB.getLoginStatus, FB.api, authResponse, pages.isFan, access.token and Javascript SDK and a little bit PHP SDK.
I saw one, almost perfect that can be site-integrated, fully-explained, and free in this blog: http://daneworx.blogspot.com/2014/02/how-to-force-users-to-like-your-page.html

Related

Get Likes on fb fan page but referrals to website

Ideally this is what I would want:
I have a fb fan page with around 2000 likes. I also have a fb app by
which I can run social plugins on my website. I put up a like button
using the following code on my website: {fb:like
href="http://facebook.com/traveltriangle"}
I want to show Like button on my website such that if user clicks on
it, my fan page's 'like' increases. However I also want that for the
post that goes on user's timeline, it links to my website and not to my fan page.
How do I achieve this?
I am also fine if I change href in the fb:like code to point it to my website. However then the referral links are good, but I can not use those likes to post my users later.
I don't think you can use merge tam. Fb Fan page is one thing and Fb App is other thing. FB App helps you get user data from what I know from their database while Fan page helps you promote your business.
Why do you need to merge them?

Facebook Development - Simple question on best approach

I am a PHP developer, but completely new to this Facebook stuff and am getting all confused. The whole Apps vs Pages vs Fan Pages terminology is driving me nuts. Please help!
My client's requirements:
1) Display Like button on a single web page
2) When Like button is clicked, content on the page is unlocked and displayed (PHP)
3) Future visits to the page detects that visitor already likes the page, and content remains unlocked (PHP)
4) All updates to web page profile on FB will show on Likers' news feed
My understanding is that the cleanest way of doing (3) above is to use the PHP SDK. But to do this, I need to create an app (to get the App ID). So I created an App. I 'liked' the App from my FB profile. Updates to my app are posted to my news feed. So far, so good.
However when I try and implement the PHP SDK, it only works if I authorize the App to my account first. Is there a way of avoiding this authorization step just for a simple "Like" (I ask because I didn't have to authorize anything when liking the app within FB)? If this authorization is unavoidable, are there any alternatives to Apps that would allow me to achieve the above requirements?
Ideally, I'd like to use just "Pages" to do this, and not Apps, but I believe I cannot achieve (2) and (3) with pages, correct (remembering everything needs to be server side, so no JavaScript showing and hiding layers etc)?
I would be grateful for any guidance.
Thanks.
So I'm assuming what we are talking about here is a Facebook tab - the 520 pixel wide applications that can go in Fan pages?
If not, you will not be able to make this happen without permissions. It sounds like that is what you're talking about, though.
Here's an example of an Facebook tab on the Coca Cola fan page:
In a tab, the PHP SDK will tell you if the user is a fan of the page (not of the app, of the page). You'll need to read the signed request - there will be a parameter there called Page, which tells you if the user is already a fan (see https://developers.facebook.com/docs/authentication/signed_request/). You get this without having to authorize.
I usually read all this and store whether the user is a fan in a boolean variable. Then later in my page I'll do something like this:
<?php if ($isFan):?>
Content for fans here
<?php else:?>
Content for non-fans here
<?php endif;?>
Keep in mind that it is only telling you if the user is a fan OF THAT PAGE - if you set up your app on a test page, for instance, it'll tell you if the user is a fan of that test page or not, NOT if the user is a fan of your app.
In order to read what a facebook user likes using the PHP SDK, you will need the user_likes permission. You may however, be able to hack something together by rendering a like button on your page somewhere and detecting the color of the button, meaning the user has liked the page. This may be problematic because of cross domain issues considering the like button is rendered as an iframe.
Best of luck!
For some things, you need an app. Like restricting access to content if the user has "Liked" something. You need custom code to do that. You don't need an app for a basic "Like" button, but you really can't get any stats on the Likes. You can link an app to a website, so that you can report on the content and referrals. If you go to http://www.facebook.com/insights/ you can link the app with a website so the insights/reporting are combined. Just click on the "Insights for your Website" button. It does require validation.
That said, your confusion is the norm. Apps, Pages and Fan Pages are almost the same thing. They are all referenced through numerical ID. There are subtle feature differences between Pages and App Pages. An app can be added to any Page if it is configured to do so. But you can't add a Page to another Page.
You can use FQL to query if a user is a fan of your app, instead of the Page you are currently on.
Facebook controls what gets shown in the news feed. Just because you post to the feed, doesn't mean it will show. However, if you are an admin of the Page and/or App, posts will always show in your feed.

Detect if Facebook user likes a page without app authorization

I'm building an iframe Facebook application and I want to set up a 'like gate' where a user has to like my page to continue past the opening of the application. (After they click like I allow them to click a 'continue' button using JavaScript).
Is there any way to detect if a visiting Facebook user has liked a page without first forcing them to authorize my application? I know I can query their likes using the graph api or fql but I'd like to avoid forcing them through the auth dialog for this one part of the app. The reason I ask is that I've seen some applications on Facebook that appear to allow this functionality.
For example, this page:
http://www.facebook.com/velcrobrand?sk=app_156218351098324
I don't have to authorize the facebook application but the page knows if I have liked it or not.
I've made some progress figuring this out.
http://www.chilipepperdesign.com/2011/02/15/reveal-fan-gate-like-gate-facebook-iframe-tab-tutorial-with-php
The method described in the above link only works if the page is loaded inside a tab of an application fan page and NOT the applications primary iframe page.
Here: 'pages' object is present
http://www.facebook.com/apps/application.php?id=249709505050393&sk=app_249709505050393
Here: 'pages' object is not present
http://apps.facebook.com/flipkey/
Not sure why this is but I think I have enough to move forwards and create my fan/like-gate.

How to do like page on facebook in program side

I have problem on Facebook "like" button.
I put facebook "like" button in my page but I click that button it is not navigate to what I gave in href link and I want to perform facebook "like" button action same as facebook.
I can "like" this link on facebook how to do same as in my website using facebook "like" button ?
You can only 'Like' a fan Page by clicking the FB supplied button that sits in the parent FB page outside of your iframed application page. As frustrating as this can be to designers and UX developers it is potential security flaw if an application (boxed in as a Fan page) is allowed to 'Like' itself. I.e. users could be duped into 'Liking' a Page onload without their consent.
You can get the count of Likes for a Fan page. That is the only 'Like' action permitted on this object type.
http://forum.developers.facebook.net/viewtopic.php?pid=294757
You can't add likes to a profile using the Facebook Api.
Read here for more details 'Like' a page using Facebook Graph API
Unfortunately, this is not possible. You can only like a post via the graph api acccording to the docs.
Unfortunately it is not possible via any of the API's to like a page programmatically.
This is to prevent spam where people create apps to mass-like pages.
Hope this helps.
You cannot make a user like a page. That isn't possible unless you use a XSS attack (which facebook probably prevents), and you'll get banned from facebook. If you want to know how to place a like button, see http://developers.facebook.com/docs/reference/plugins/like/

Facebook page apps - Authorizing a user

I can't seem to find exactly what I'm looking for. We're trying to build an app to run solely on a Facebook Page. We want to show a landing page if they don't Like the page, and the contest entry form if they do. This functionality works.
Before showing the contest entry form, we'd like to authenticate the user viewing the app so that they can just hit "Enter the contest!" and we can automatically pull a name/email address.
Any of the methods of authentication I've seen described, including through the Facebook Developer docs, don't work at all.
I saw something that said they need to interact with the app first, then you can get the id, but that doesn't work either. I also don't get the page id passed with the signed request.
Its also pretty unclear whether I should be using an iframe or just FBML.
Could anyone point me in the right direction, please? Thanks!
You need to create a fan page and add the FBML plugin to that page, then you will need to insert a short code that will determine if a facebook user has clicked 'Like' or not and by determining that you will decide weather to display the content of the landing page or not (using an iframe). You will probably like to also set the FBML box that you create as the default view for members who didn't press the 'Like' button yet, you can change the default view in your fan page settings.
On the iframe, you will need to use the Facebook API if you want to retrieve any user information from Facebook, for that, you will need to register a new application with Facebook. Go to developers.facebook.com for the API integration and app registration.
Also, what do you mean when you say:
Any of the methods of authentication
I've seen described, including through
the Facebook Developer docs, don't
work at all.
Well, it appears you can't do it that way. The client was very specific in wanting that functionality but we ended up convincing them to go for a redirect to the canvas page to have the app authorized and the contest entered instead.