Rewarded Video

Rewarded video ads are full-screen videos that appear inside your application.

1. Load

To load a rewarded video, first create the following load callback object:

const loadOpts = {
    didLoad: function(response) {
        // rewarded video is loaded
    },
    didFailToLoad: function(error, response) {
        // rewarded video failed to load
    }
};

Once that is done, you can call the load method on the Tapdaq interface, passing in the placement tag you with to load an ad for, and the callback object you just created, like so:

Tapdaq.loadRewardedVideo("my_rewarded_tag", loadOpts);

2. Display

Next, you need to display the rewarded ad to the user when they tap a button. Let's say you linked a tappedReward() method to a button.

const showOpts = {
    willDisplay: function(response) {
    },
    didDisplay: function(response) {
    },
    didFailToDisplay: function(error, response) {
    },
    didClick: function(response) {
    }, 
    didValidateReward: function(response) {
    },
    didClose: function(response) {
    }
};

const tappedReward = function(event) {
    Tapdaq.isRewardedVideoReady("my_rewarded_tag", function(ready) {
        if (ready) {
            Tapdaq.showRewardedVideo("my_rewarded_tag", showOpts);
        }
    });
};

This code checks to ensure there is a rewarded video ready to display before displaying it.

If you want to check a rewarded video is loaded before displaying the button a user would tap to see the reward, show the button when the didLoad callback occurs, like so:

const loadOpts = {
    didLoad: function(response) {
        // Add code here to display or enable your Rewarded Video button.
    }
};

This ensures that the button is only displayed after a rewarded video has been successfully loaded and is ready to play. For a full list of rewarded video delegate methods we support, see our Advanced page.

Note: We strongly advise against trying to show a rewarded video ad on application launch.*

3. Reward the user

Once the user has watched a video, the player should be rewarded. Implement the didValidateReward callback in the callback object to obtain the reward.

const showOpts = {
    didValidateReward: function(response) {
        console.log("The user received a reward! ID: " + response.reward.eventId + ", Tag: " + response.reward.placementTag + ", Name: " + response.reward.name + ", Value: " + response.reward.value + ", isValid: " + response.reward.isValid + " Custom JSON: " + response.reward.customJson);
    }
};

Export your application to iOS and Android, then run your application to test the ad displays correctly.

4. Load another rewarded video on close

If you wish to load another video after you have shown one, implement the didClose callback, then pass in the callback object when showing an ad, like so:

const showOpts = {
    didClose: function(response) {
        Tapdaq.loadVideo("my_rewarded_tag", loadOpts);
    }
};

Tapdaq.showRewardedVideo("my_rewarded_tag", showOpts);

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated a rewarded video into your app, what would you like to do next?