A fan gate or a ‘like gate’ allows your page to display different contents to those who are not fans and to those who are fans. A fan gate offers exclusive content to those who have ‘liked’ your Facebook page, those who have not will see a tab asking users to like the page in order to see what’s behind it. Fan gate simply helps to increase the likes of your page.
Fangate or Prelike function is very common in Static HTML iframe tab for Facebook and extensively used by social media marketers to drive the number of their Facebook likes via various campaigns.
How to Add Fan Gate for Facebook Apps
We can add Fan Gate or Like Gate, a Pre-like function to our Facebook apps which may ensure that only those who has liked your page can use the apps, this may help to increase likes of your page exponentially. If you add Pre-like function to your Facebook apps, it’ll make compulsory that a user must like your facebook page to continue in your facebook app, Just add this following condition in your code –
$signed_request=$facebook->getSignedRequest();
if (isset($signed_request[‘page’][‘liked’]) && !empty($signed_request[‘page’][‘liked’]))
{
//Your main code will go here
//——————————
}
else
{
echo “Like this page first to continue”;
}
you can also add image instead of texts –
For image add this
printf(“<img src=’http://s3.amazonaws.com/Techshu/fb/pre-like/like-this-page.jpg’ width=’805′ height=” alt=’LIKE’>”);
in the else part.