O'Reilly logo

Facebook Application Development with Graph API Cookbook by Apeksha Singh, Shashwat Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing custom offers

Facebook allows us to earn credits by completing certain offers. This is most beneficial when we do not want to pay from our own account.

Getting ready

You should have created index.php as mentioned in the beginning of Chapter 5.

How to do it...

The following steps will demonstrate the implementation of custom orders:

  1. Open index.php and add the following highlighted code inside the div named fb-root as shown:
    <div id="fb-root">
      <ol>
      <li><a href="#" id="earncredit">Earn Credits through Offers</a></li>
      </ol>
    </div>
  2. Next, add the following highlighted code to the function assigned to window.fbAsyncInit, just after the FB.init() function:
     window.fbAsyncInit = function() { FB.init({appId: 'your_app_id', status: true, cookie: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required