TapResearch AdobeAir Integration Guide

Getting Started * Create an app and grab your API Token. * Add a test device * Read how to work with an app in test mode

Download the SDK

You can download the latest version of the TapResearch AdobeAir SDK on GitHub.

Integrate TapResearch

  • Open project properties in Flash Builder
  • Select the “ActionScript Build Path” page
  • Select the “Native Extensions” tab
  • Click Add Ane... and select libTapResearchAne.ane
  • Select ActionScript Build Packaging click the Native Extensions tab and make sure that for both Apple iOS and Google Android the extension is packaged
  • Add the following to the descriptor file in the Android manifest section
<activity android:name="com.tapr.internal.activities.survey.SurveyActivity"
  android:hardwareAccelerated="true" android:configChanges="orientation|keyboardHidden|screenSize"/>

Integrate Google Play Services

The TapResearch SDK depended on Google Play Services to run on Android devices. The dependency is packaged as a separate extension to avoid collisions with other extensions that may have packaged the Google Play Services. Please note that the TapResearch extension only contain a subset of Google Play Services.

  • Open project properties in Flash Builder
  • Select the “ActionScript Build Path” page
  • Select the “Native Extensions” tab
  • Click Add Ane... and select libTapResearchGps.ane
  • Select ActionScript Build Packaging click the Native Extensions tab and make sure that only for Google Android the extension is packaged
  • Add the following to the descriptor file in the Android manifest section

  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

Initialize TapResearch

Initialize the TapResearchSDK as early as possible so TapResearch can start getting surveys ready for your users. To initialize the SDK use the following methods

  • TapResearch.instance.isSupported to verify the platform is supported
  • TapResearch.instance.configure(<apiToken>) to initiate the SDK, the method only needs to be called once on app launch.

  import com.tapresearch.ane.TapResearch;

  if (!TapResearch.instance.isSupported)  {
      return;
  }

  var apiToken:String;
  if(Capabilities.os.indexOf("iPhone") >= 0) {
      apiToken= "ios_api_token"
  } else if (Capabilities.os.indexOf("Android") >= 0) {
      apiToken = "android_api_token";
  }

  TapResearch.instance.configure(apiToken);

Placements

A placement is the allocated section in your application where you want to provide access to TapResearch's survey wall, like an action button or a list item. To create a placement, navigate to the app settings in the supplier dashboard click settings and add the placement. The placement is encapsulated by the TRPlacement object which contains the placement metadata and the method to display the survey wall.

Initialize a placement

To initialize a placement, it is best practice to call the SDK as late as possible before displaying the placement in the app. For example, you can initialize it in the Start method of the scene where the placement will be visible


  TapResearch.instance.addEventListener(TapResearch.PLACEMENT_READY, onPlacementReady);
  TapResearch.instance.initPlacement(PLACEMENT_IDENTIFIER);

  ...

  protected function onPlacementReady(event:Event):void
  {
    placement = TRPlacement(event);
    if (placement.placementCode != TRPlacement.PLACEMENT_CODE_SDK_NOT_READY) {
      if (placement.isSurveyWallAvailable) {
        //Show the placement
      }
    } else {
      // The SDK isn't ready
    }
  }

Notice that the survey wall may or may not be available to a specific user and it's important to check survey availability before displaying the placement.

Please note that if the placement request was fired before that SDK is ready the OnPlacementReady will be called twice. The first time PlacementCode will return TRPlacement.PLACEMENT_CODE_SDK_NOT_READY indicating that the request was fired before the SDK was ready, the second call will return the latest placement from the server.

Display the survey wall

To display the survey wall, call the ShowSurveyWall on your TRPlacement object.


  placement.showSurveyWall();

Please Note: A placement can only show the survey wall one time. Once the survey wall is dismissed, you'll have to initialize a new TRPlacement object if you wish to keep the placement visible in the app.

Hot Survey

hasHotSurvey is a placement attribute that indicates a special, high yield survey is available for this user. When this attribute is true, the user should be shown a special call to action to encourage them to take advantage of this opportunity. These special survey opportunities may only be available for a few minutes, so initPlacement should be called whenever the parent view is loaded.

Reward Postback / Callback

Depending on your preferences the rewards notification will be posted to a url or will trigger an in-game game callback. Please follow the instructions below for server postback or in-game callback implementations

Server to server postback

If you set a postback URL for your app, you will be required to pass us a unique user identifier through the method shown below. This identifier will be included inside the postback payload. You should set the unique user identifier before you call the Configure() method. For more information, please visit our API docs.


  TapResearch.instance.configure(API_TOKEN);
  TapResearch.instance.setUniqueUserIdentifier(USER_IDENTIFIER);

In-Game callback

Assign your reward event listener so we can notify you when a user completes a survey. The quantity value will automatically be converted to your virtual currency based on the exchange rate you specified in your app settings . It is important to note that this method may be called back to back if the player completed multiple surveys in one session. You'll want to assign your delegate before calling the Configure() method.


  import com.tapresearch.ane.DidReceiveRewardEvent;

  TapResearch.instance.addEventListener(TapResearch.RECEIVE_REWARD, onReceiveReward);

  protected function onReceiveReward(event:Event):void
  {
      var rewardEvent:ReceiveRewardEvent = ReceiveRewardEvent(event);
      trace(rewardEvent.rewardAmount);
      trace(rewardEvent.transactionIdentifier);
      trace(rewardEvent.currencyName);
      trace(rewardEvent.offerIdentifier);
      trace(rewardEvent.eventType);
  }

Survey callbacks (Optional)

Assign a event listeners if you want to be notified when the survey wall status changed


  TapResearch.instance.addEventListener(TapResearch.SURVEY_WALL_OPENED, onSurveyWallOpened);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_WALL_DISMISSED, onSurveyWallDismissed);

  private function onSurveyWallOpened(event:Event):void
      // Stop music, timers, etc.
  }

  private function onSurveyWallDismissed(event:Event):void
      // Start music, timer, etc.
  }

Customise the survey wall

If you wish to customise the look of the survey wall modal to fit with the rest of your app use the following:


  TapResearch.instance.setNavigationBarText("Title");
  TapResearch.instance.setNavigationBarColor("#AADDAA");
  TapResearch.instance.setNavigationBarTextColor("#FF11FF");

Upgrade to v2.0.0

The following methods and callbacks were removed from the SDK

  TapResearch.instance.isSurveyAvailable()
  TapResearch.instance.isSurveyAvailableWithIdentifier(identifier)
  TapResearch.instance.showSurvey();
  TapResearch.instance.showSurveyWithIdentifier(identifier);


  TapResearch.instance.addEventListener(TapResearch.SURVEY_AVAILABLE, onSurveyAvailable);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_NOT_AVAILABLE, onSurveyNotAvailable);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_MODAL_OPENED, onSurveyModalOpened);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_MODAL_CLOSED, onSurveyModalClosed);

  TapResearch.instance.addEventListener(TapResearch.SURVEY_AVAILABLE_WITH_PLACEMENT, onSurveyAvailable);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_NOT_AVAILABLE_WITH_PLACEMENT, onSurveyNotAvailable);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_MODAL_OPENED_WITH_PLACEMENT, onSurveyModalOpened);
  TapResearch.instance.addEventListener(TapResearch.SURVEY_MODAL_CLOSED_WITH_PLACEMENT, onSurveyModalClosed);

Test Devices

Before you are ready to go live, it is important that your reward callback is working properly. Navigate to your dashboard and click the Add Devices button. Add a device name and your Google Advertising ID. Now, when you enter our survey flow through your app, you will be able to complete a test survey and receive a test reward when you re-open your app.

Troubleshooting

Survey wall isn't available

If placement.isSurveyWallAvailable is false please reference the android or ios integration guides for further steps

Contact

Please send all questions, concerns, or bug reports to developers@tapresearch.com.

FAQ

Do we have to pay to use the TapResearchSDK?

No. Our SDK is completely free of charge. In fact, we pay you every time a user completes a survey.

What measures do you take to protect user privacy?

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

What kind of analytics do I have access to?

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 a few hundred 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 need to update the status of your app so your users can see real surveys. Note, test devices will only be able to see a test survey.