Table of Contents
- 1 Summary
- 2 Tapjoy SDK 11 Instructions
- 3 Integrating Tapjoy into your iOS, Android, or Unity App
- 4 Tapjoy Network Setup in MoPub
- 5 Tapjoy Rewards in MoPub
- 6 Sample code
[Alert May 2016]: Note from Google: If you are using a Mopub SDK version before 4.4.0, you should update right away to address a security issue. After July 16, 2016, Google will start rejecting apps that include Mopub versions earlier than 4.4.0. For more information, see Google’s FAQ answer about Mopub.
This guide will cover how to integrate Tapjoy as an ad network through MoPub mediation for running rewarded videos, using Tapjoy 11.x (current and recommended).
Overview of Mopub Adapter mediation
In this configuration, your application talks to the Mopub SDK, which in turn requests content from the Tapjoy SDK. Reward information is passed directly from Tapjoy’s SDK to your application, or from Tapjoy’s server to your server (see the section on Rewards below). Here is a diagram showing the flow of information in a Tapjoy -Mopub adapter mediation:
Using Tapjoy Functionality with Mopub-Tapjoy Adapter Integration
Many publishers wish to use Tapjoy functionality (OfferWall, IAP Promotion, Analytics, etc.) along with using Tapjoy as an ad provider for a Mopub Adapter Mediation. Since part of the Mopub Adapter Mediation includes an integration of the Tapjoy SDK, all Tapjoy functionality is available to your application without any additional integration steps.
Tapjoy SDK 11 Instructions
- Tapjoy SDK 11.0.3 or above: Download
- MoPub SDK (this adapter was tested with MoPub 4.0): Download
- Tapjoy Custom Event code: iOS, Android, Unity
Before You Start, Make Sure:
- Your app is registered in your MoPub account and has the MoPub SDK integrated
- Your app has configured the Rewarded Ad Unit on MoPub and has included the Tapjoy custom event code
- You have read through MoPub Getting Started guides for Android and iOS, or Unity
- You have a Tapjoy dashboard account and SDK key for the app you want to run ads
- You have set up Tapjoy "Video" content card via the Placements framework on the Tapjoy Dashboard. You must set up a User Initiated Placement and connect an "Video" content card to that placement. (NOTE: this should be a regular "Video" content card, not the "Mediated Video" content card, which is for Platform mediation.) Please see the links below for more details:
Integrating Tapjoy into your iOS, Android, or Unity App
- Follow the instructions to integrate the Tapjoy embedded framework and make the connect call to initialize Tapjoy. Make sure to call ‘connect’ to start the Tapjoy SDK.: http://dev.tapjoy.com/ sdk-integration/ios/getting-started-guide-publishers-ios/
- Integrate the pre-built Tapjoy-MoPub Rewarded Video adapter for iOS (available on MoPub GitHub)
- Follow the instructions to integrate the Tapjoy jar and make the connect call to initialize Tapjoy: http://dev.tapjoy.com/sdk-integration/android/getting-started-guide-publishers-android/
- Integrate the pre-built Tapjoy-MoPub Rewarded Video adapter for Android (available on MoPub GitHub)
- Integrate the Tapjoy SDK: dev.tapjoy.com/sdk-integration/unity/getting-started-guide-publishers-unity/
- Integrate the MoPub Unity SDK: https://dev.twitter.com/mopub/
- Integrate the Tapjoy-MoPub Rewarded Video Adapters. We have a unitypackage that contains the adapter files here for your convenience. You can download the unitypackage for the adapter files on Tapjoy’s bintray here:https://bintray.com/tapjoy/mediation-unity/mopub
Tapjoy Network Setup in MoPub
Follow the instructions here explain how to add a Custom Native Network to your Mopub setup. You must do this for Tapjoy. For your convenience, we have included instructions specific for Tapjoy here:
- In the Mopub Dashboard, go to the Networks tab, and click "Add a Network”.
- Select "Custom Native Network" and you’ll reach the campaign creation page:
- Give it the title of "Tapjoy".
- For each Ad Unit, configure the ‘Custom Event Class’ and ‘Custom Event Class Data’ columns:
For running rewarded video ads, in the ‘Custom Event Class’ column enter:
TapjoyRewardedVideoCustomEvent for iOS
TapjoyRewardedVideo for Android.
For running interstitial ads, in the ‘Custom Event Class’ column enter:
TapjoyInterstitialCustomEvent for iOS
TapjoyInterstitial for Android
- In the “Custom Event Class Data” column, define a JSON object with the placement name as defined by your Tapjoy placement.For example, if the Tapjoy placement name is "level_complete" the JSON would be:
Tapjoy Rewards in MoPub
Tapjoy provides the ability for Publishers to manage currency rewards depending on how/where the currency balance is maintained:
- Managed Currency: Tapjoy has a free service that publishers can use to hold the user stored value accounts for their virtual currencies. The service provides a ledger for holding the currencies earned (or purchased) by the users. Majority of the publishers that use Tapjoy use this service to hold their currency balances. For publishers that are using this service, Tapjoy manages and updates the currency rewards based on the completion of ad actions. More details on how to use the service and how to update balances can be found here: http://dev.tapjoy.com/virtual-currency/managed-currency/
- Self-Managed Currency: Publishers that are managing the currency balances on their own will need to provide a post-back URL to Tapjoy. The post-back URL will receive the reward amount upon successful completions of ad actions (i.e. watching a video): http://dev.tapjoy.com/virtual-currency/non-managed-currency/
Please note that in the current implementation, Tapjoy does not pass the reward amount to the MoPub framework, this means publishers will not get the reward amount in the reward callback as provided by the MoPub framework. Instead, the currency reward will be handled by Tapjoy (outside of the MoPub adapter) depending on the type of currency (managed vs. self-managed as described above) used in the application.
This sample code shows how to interface between MoPub’s rewarded video callbacks and Tapjoy’s Virtual Currency system ( for ‘managed currency’ only):