TheoremReach Javascript/Web Integration Guide

Get Your API Key

Sign-up for a new developer account and create a new Web app here and copy your API Key.

Install SDK

Include the required javascript files:


  <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
  <script type="text/javascript" src="https://s3.amazonaws.com/cdn.theoremreach/v1/theorem_reach.min.js"></script>

Initialize TheoremReach

We recommend initializing TheoremReach as soon as possible in your code so that we can begin getting surveys ready for the user.



  <script>
    let TR = new TheoremReach("YOUR_API_TOKEN", "YOUR_USER_ID");

    // if iOS, set the Apple Advertising ID to ensure the most number of surveys are available
    TR.idfa = "YOUR_APPLE_ADVERTISING_ID";

    // if Android, set the Google Advertising ID to ensure the most number of surveys are available
    TR.gpsid = "YOUR_GOOGLE_ADVERTISING_ID";

  </script>

Reward Center

Next, implement the logic to display the reward center. Call the showRewardCenter() method when you are ready to the send the user into the reward center where they can complete surveys in exchange for your virtual currency. We automatically convert the amount of currency a user gets based on the conversion rate specified in your app.

You can optionally check to see if the user has a survey available to take before launching the reward center with the isSurveyAvailable() method. Note - this method will return true only after the SDK has completely finished initializing.


  if (TR.isSurveyAvailable()) {
    TR.showRewardCenter();
  }

  // implemented as an onclick method in a button:
  <button class="button" onclick="if (TR.isSurveyAvailable()) {TR.showRewardCenter()}">Take Surveys, Earn Coins!</button>

Reward Callback

To ensure safety and privacy, we notify you of all awards via a server side callback. In the developer dashboard for your App add the server callback that we should call to notify you when a user has completed an offer. Note that the user ID passed into the initialize call will be returned to you in the server side callback. More information about setting up and testing the callback can be found in your app dashboard.

The quantity value will automatically be converted to your virtual currency based on the exchange rate you specified in your app. Currency is always rounded in favor of the app user to improve happiness and engagement.

Contact

Please send all questions, concerns, or bug reports to admin@theoremreach.com.

FAQ

What do you do to protect privacy?

We take privacy very seriously. All data is encrypted before being sent over the network. We also use HTTPS to ensure the integrity and privacy of the exchanged data.

What kind of analytics do you provide?

Our dashboard will show metrics for sessions, impressions, revenue, and much more. We are constantly enhancing our analytics so we can better serve your needs.

What is your fill rate?

We have thousands of surveys and add hundreds more every day. Most users will have the opportunity to complete at least one survey on a daily basis.

I'm ready to go live! What are the next steps?

Let us know! We'd love to help ensure everything flows smoothly and help you achieve your monetisation goals!