Rewarded videos are user-initiated ads where users can earn in-app rewards in exchange for viewing a video.
1. Manual caching
By default, auto caching is enabled: Appodeal SDK starts to load Rewarded Video right after the initialization method is called. The next Rewarded Video ad starts to load after the previous one has been shown.
To disable automatic caching for Rewarded Video, use the code below before SDK initialization:
To cache a Rewarded Video, use:
2. Checking if rewarded video has been loaded
You can check if the ad has been loaded before showing it. This method returns a boolean value indicating whether or not the Rewarded Video has been loaded.
3. Displaying rewarded video
4. Rewarded video placements
Appodeal SDK allows you to tag each impression with different placement. To be able to use placements, you need to create them in Appodeal Dashboard. Read more about placements.
If you have no placements or call
Appodeal.show with a placement that does not exist, the impression will be tagged with 'default' placement with corresponding settings applied.
Placement settings affect ONLY ad presentation, not loading or caching.
5. Using rewarded video callbacks
Callbacks are used to track different events in the lifecycle of an ad, e.g., when an ad was clicked on or closed. To get them, you need to set the delegate as follows:
Now you can use the following callback methods:
6. Server-to-Server (S2S) rewarded video callbacks
To secure your apps economy we offer S2S reward callbacks. To validate each reward, you need to set up a callback URL on your server that will receive the reward information. We will pass the user data to your callback URL, which you will need to validate and adjust the user balance accordingly.
1. Create the reward callback URL on your server that will receive the reward information.
2. Fill the created URL and the encryption key in the app settings in your dashboard.
3. The reward callback will be sent to your URL using GET request with two parameters:4. Your URL should decrypt the data and validate it.
impression_id for uniqueness and store it in your system to prevent duplicate transactions.
To set user ID, use the
Appodeal.getUserSettings(this).setUserId("User#123") method before SDK initialization.
We offer sample scripts in Go, PHP, Ruby, Java, Node.js, Python 3 and C# to decrypt the data. If you need samples in other languages, please contact our support team and we will provide them to you.
Sample in PHP: reward.php.
Sample in Ruby: reward.rb.
Sample in Java: reward.java.
Sample in Node.js: reward.js .
Sample in Python 3: reward.py.
Sample in C#: reward.cs.
Sample in Go: reward.go.
7. Getting reward data for a specific placement
To get reward details (currency, name and amount) for any placement, use the
rewardForPlacement:(NSString *)placement method:
8. Getting predicted eCPM
This method returns the expected eCPM for the cached ad. The amount is calculated based on historical data for the current ad unit.
9. Checking if rewarded video has been initialized
true if the Rewarded Video has been initialized.
10. Check if autocache is enabled for rewarded video
true if autocache is enabled for Rewarded Video.