How do I check if a user is a fan of my facebook page on my website?

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-02-12T05:58:50Z Indexed on 2010/04/06 1:13 UTC
Read the original article Hit count: 346

I want to check if my users are fans of my facebook page. I think something like this should do it:

    <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script>
<script type="text/javascript">FB.init("my api key","xd_receiver.htm");</script>
    <script type="text/javascript">
    //<![CDATA[ 
    FB_RequireFeatures(["Api"], function(){

    var api = FB.Facebook.apiClient;
            api.pages_isFan(PAGE_ID,gigyaUser.FACEBOOK_USER_ID,function(response){
         alert(response);
    });

    });

    //]]>
    </script>

However, for some reason I keep getting null even though the user is in fact a fan of the page. Am I missing something?

© Stack Overflow or respective owner

Related posts about facebook-api

Related posts about facebook-connect