Rewarded and Fullscreen Video
Rewarded and Fullscreen Video Unity Plugin
Before you begin!
Make sure that you have completed the Unity Plugin installation before you begin integrating the Rewarded/Fullscreen video ad unit
Integrating the Rewarded/Fullscreen video ad unit
Step 1: Initialize the FullScreen / Rewarded
To initialize the FullScreen or the Rewarded video, add the following line to your code:
FullscreenVideo fullscreenVideo = new FullscreenVideo("<ADD_HERE_YOUR_PLACEMENT_ID>");
//Or
RewardedVideo rewardedVideo = new RewardedVideo("<ADD_HERE_YOUR_PLACEMENT_ID>");
Make sure to add appnext's namespace
"using appnext;"
Step 4: Caching
To cache an ad, use the following line:
fullscreenVideo.loadAd();
//Or
rewardedVideo.loadAd();
Step 5: Showing the ad
To show the ad, use the following line:
fullscreenVideo.showAd();
//Or
rewardedVideo.showAd();
Step 6 (optional): Delegate
To use delegates add the proper delegate method to the Ad
//Fullscreen:
// Get notified when the ad was loaded:
fullscreenVideo.onAdLoadedDelegate += onAdLoaded;
// Get notified when the ad was clicked:
fullscreenVideo.onAdClickedDelegate += onAdClicked;
// Get notified when the ad was closed:
fullscreenVideo.onAdClosedDelegate += onAdClosed;
// Get notified when an error occurred:
fullscreenVideo.onAdErrorDelegate += onAdError;
// Get notified when the ad’s video playing ended:
fullscreenVideo.onVideoEndedDelegate += onVideoEnded;
//Rewarded:
// Get notified when the ad was loaded:
rewardedVideo.onAdLoadedDelegate += onAdLoaded;
// Get notified when the ad was clicked:
rewardedVideo.onAdClickedDelegate += onAdClicked;
// Get notified when the ad was closed:
rewardedVideo.onAdClosedDelegate += onAdClosed;
// Get notified when an error occurred:
rewardedVideo.onAdErrorDelegate += onAdError;
// Get notified when the ad’s video playing ended:
rewardedVideo.onVideoEndedDelegate += onVideoEnded;
The method signature should be:
void <name>(Ad ad){..}
The error delegate signature should be:
void <name>(Ad ad, string error){..}
The video ended delegate signature should be:
void <name>(Video ad){..}
Make sure to remove the delegates if you wish to stop receiving the events or when you dispose
fullscreenVideo.onAdLoadedDelegate -= onAdLoaded;
fullscreenVideo.onAdClickedDelegate -= onAdClicked;
fullscreenVideo.onAdClosedDelegate -= onAdClosed;
fullscreenVideo.onAdErrorDelegate -= onAdError;
fullscreenVideo.onVideoEndedDelegate -= onVideoEnded;
And for the rewarded unit:
rewardedVideo.onAdLoadedDelegate -= onAdLoaded;
rewardedVideo.onAdClickedDelegate -= onAdClicked;
rewardedVideo.onAdClosedDelegate -= onAdClosed;
rewardedVideo.onAdErrorDelegate -= onAdError;
rewardedVideo.onVideoEndedDelegate -= onVideoEnded;
Step 7 (optional): Configure Video FullScreen/Rewarded
In order to change the Fullscreen / Rewarded configuration, call any of the following functions before showing the unit:
//Fullscreen:
fullscreenVideo.setButtonColor("#6AB344");
fullscreenVideo.setButtonText("example");
fullscreenVideo.setPostback("custom_parameter");
fullscreenVideo.setCategories("example");
fullscreenVideo.setMute(false);
fullscreenVideo.setProgressType(Video.PROGRESS_CLOCK);
fullscreenVideo.setProgressColor("#ffffff");
fullscreenVideo.setVideoLength(Video.VIDEO_LENGTH_LONG);
//Or
//fullscreenVideo.setShowClose(true, 5000);
fullscreenVideo.setOrientation(Ad.ORIENTATION_LANDSCAPE);
//Rewarded:
rewardedVideo.setButtonColor("#6AB344");
rewardedVideo.setButtonText("example");
rewardedVideo.setPostback("custom_parameter");
rewardedVideo.setCategories("example");
rewardedVideo.setMute(false);
rewardedVideo.setProgressType(Video.PROGRESS_CLOCK);
rewardedVideo.setProgressColor("#ffffff");
rewardedVideo.setVideoLength(Video.VIDEO_LENGTH_LONG);
//Or
//rewardedVideo.setShowClose(true, 5000);
rewardedVideo.setOrientation(Ad.ORIENTATION_LANDSCAPE);
List of configurable options:
Button Text:
The install button's text (default is "Install")
Button Color:
The install button's color - a 6 hex chars starting with # (default is "#6AB344")
Category:
Set preferred ad categories
Install Postback:
Postback parameters that will be posted to your server after user installed an app (make sure to encode the values)
Mute Video:
Mute the video which is played in the Fullscreen/Rewarded (default is "false")
- true
- false
Progress Type:
Choose progress type, or hide it (default is "Video.PROGRESS_CLOCK")
- Video.PROGRESS_CLOCK
- Video.PROGRESS_BAR
- Video.PROGRESS_NONE
Progress Color:
Set progress bar / clock color. 6 characters hex starting with # (default is #ffffff)
Video Length:
Set video length - 15 or 30 seconds long (default is VIDEO_LENGTH_DEFAULT)
- Video.VIDEO_LENGTH_SHORT - Up to 15 seconds long videos
- Video.VIDEO_LENGTH_LONG - 20-60 seconds long videos
- Video.VIDEO_LENGTH_DEFAULT - Appnext's algorithm priority. Any available video campaign will be served
Please note that if no SHORT type length videos are available, long videos will be served
Orientation:
Set the preferred orientation if both landscape and portrait are supported by the application (default is ORIENTATION_DEFAULT)
- Ad.ORIENTATION_DEFAULT
- Ad.ORIENTATION_LANDSCAPE
- Ad.ORIENTATION_PORTRAIT
- Ad.ORIENTATION_AUTO
Step 8: Server-side postback - Rewarded Video ONLY
You can choose to receive server-side postbacks whenever a user finishes watching a video ("video ended" event).
The "video ended" event will serve as a trigger for the reward action.
Please note that in addition to configuring the postback in this integration process, you will also need to set your postback URL on the Appnext Self-Service platform (under the "Apps" page / app "Settings & Placements" / "Advanced Settings').
In order to receive the server-side postback on the "video ended" event, call the following functions before showing the ad:
// Transaction ID - make sure to set a unique transaction ID per ad view
// User ID - pass the User ID so you will know which user to reward
// Currency Type - type of reward (life / credit / points)
// Amount - the amount of currency that was rewarded
// Custom Parameters - pass any custom value / data
rewardedVideo.setRewardedServerSidePostback("TransactionId", "UserId", "TypeCurrency", "Amount","CustomParameter");
- Make sure to encode all values passed in each function.
- Passing non null value, for at least one parameter, is mandatory for the reward to be sent.
Important Note
- Each placement has a Placement ID. If you integrate multiple placements, you will need to use a different Placement ID for each.
- The implementation should be tested on a device and not in a unity simulator.
- Make sure to use Android Placement IDs in Android project and iOS Placement IDs in iOS project.
App Categories
Android: 1. Action 2. Adventure 3. Arcade 4. Arcade & Action 5. Board 6. Books & Reference 7. Brain & Puzzle 8. Business 9. Card 10. Cards & Casino 11. Casino 12. Casual 13. Comics 14. Communications 15. Education 16. Educational 17. Entertainment 18. Family 19. Finance 20. Health & Fitness 21. Libraries & Demo 22. Lifestyle 23. Live Wallpaper 24. Media & Video 25. Medical 26. Music 27. Music & Audio | 29. Personalization 30. Photography 31. Productivity 32. Puzzle 33. Racing 34. Role Playing 35. Shopping 36. Simulation 37. Social 38. Sports 39. Sports Games 40. Strategy 41. Tools 42. Travel & Local 43. Trivia 44. Weather 45. Word *iOS:** 1. Action 2. Adventure 3. Arcade 4. Board 5. Books 6. Business 7. Card 8. Casino 9. Catalogs 10. Dice | 11. Education 12. Educational 13. Entertainment 14. Family 15. Finance 16. Food & Drink 17. Graphics & Design 18. Health & Fitness 19. Kids 20. Lifestyle 21. Medical 22. Music 23. Navigation 24. News 25. Photo & Video 26. Productivity 27. Puzzle 28. Racing 29. Reference 30. Role Playing 31. Simulation 32. Social Networking 33. Sports 34. Strategy 35. Travel 36. Trivia 37. Utilities 38. Weather |
Make sure to encode (%20) categories with more than 1 word, example: Travel%20%26%20Local
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing [email protected].
Updated about 7 years ago