Get updates, news, and event info about the latest in social media from our exclusive Agency Entourage Newsletter.
No, Fan-gate is not a political scandal involving Mark Zuckburg. Fan-gates or reveal tabs are a way to restrict certain content on your Facebook page from users until they have “Liked” your page, at which point a new page loads (or is revealed). This is a very useful way to build your page’s fans with quality content that visitors want.
However, with Facebook discontinuing support for FBML the old fb:visible-to-connection technique is no longer supported. Fortunately iframe allows for a more flexible and secure way to fan-gate content.
The reveal uses PHP, so to make sure to code your canvas app as a PHP file, setup it up as a typical Facebook iframe canvas app and add this code:
// create the Facebook Graph SDK object
require_once('facebook.php');
$facebook = new Facebook(array(
'appId'=>'#######', // replace with your appId
'secret'=>'###########' // replace with your secret
));
$signedRequest = $facebook->getSignedRequest();
// Inspect the signed request
if($signedRequest['page']['liked'] == 1){
// The content to be revealed only to fans
print 'Revealed content';
} else {
// The content to show users who are not fans
print 'Like this page!';
}
Replace the ####’s with your application “appId” and “secret” number. You then include the page content you want to reveal to fans in the “IF” section and the content to be shown to non-fans in the “ELSE” section. This technique will prevent users from simply viewing the source code to see the “hidden” content. Because it is run server side via PHP the content is truly accessible only to fans.
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
You must be logged in to post a comment.