Integrate Rewarded Ads

To integrate any ad format, you must first have completed the instructions in the basic integration article.

Rewarded ads are a full screen experience where users opt in to view a video ad in exchange for something of value, such as virtual currency, in-app items, exclusive content, and more. The ad experience grants the reward after the user has watched the video for a specified duration. When that duration has been reached, your app receives a callback to grant the reward to the user.

Create a Rewarded Ad

  1. To integrate rewarded ads in your iOS app, import VungleAdsSDK and add an instance variable for VungleRewarded in your ViewController.swift file (or ViewController.h file for Objective-C).
    import UIKit
    import VungleAdsSDK
    class LORewardedViewController: UIViewController {
        private var rewardedAd: VungleRewarded?
  2. Add the following code to your method where you want to prepare the VungleRewarded instance. To create the VungleRewarded, you will need a Placement ID.
    self.rewardedAd = VungleRewarded(placementId: <YOUR_PLACEMENT_ID>)
    self.rewardedAd?.delegate = self

Note: You must set your ViewController (or any class that declares conformance to VungleRewardedDelegate) to the delegate property of the VungleRewarded instance (refer to the Register for Callbacks section below).

Load a Rewarded Ad

  1. Once you create the VungleRewarded instance, you can load an ad by calling load().
    self.rewardedAd = VungleRewarded(placementId: <YOUR_PLACEMENT_ID>)
    self.rewardedAd?.delegate = self
  2. Your ViewController (or any class that conforms to VungleRewardedDelegate) will receive notification of load success or error through delegate callback methods (refer to the Register for Callbacks section below).

Play a Rewarded Ad

  1. Once the rewarded ad is successfully loaded, you can display it by calling present(with: <YOUR_ViewController>).
    self.rewardedAd?.present(with: <YOUR_ViewController>)
  2. During the time the rewarded ad is visible to the user, you can listen for ad lifecycle events through delegate callback methods (refer to the Register for Callbacks section below).
  3. The ad is closed when the user closes it. You do not need to add steps in your code to close it.

Register for Callbacks

To receive notifications for ad events, declare conformance to VungleRewardedDelegate protocol, and implement callback methods. Each of the callback methods is optional, so you only need to implement the methods you want.

extension LORewardedViewController: VungleRewardedDelegate {
    // Ad load events
    func rewardedAdDidLoad(_ rewarded: VungleRewarded) {
    func rewardedAdDidFailToLoad(_ rewarded: VungleRewarded, withError: NSError) {
    // Ad Lifecycle Events
    func rewardedAdWillPresent(_ rewarded: VungleRewarded) {
    func rewardedAdDidPresent(_ rewarded: VungleRewarded) {
    func rewardedAdDidFailToPresent(_ rewarded: VungleRewarded, withError: NSError) {
    func rewardedAdDidTrackImpression(_ rewarded: VungleRewarded) {
    func rewardedAdDidClick(_ rewarded: VungleRewarded) {
    func rewardedAdWillLeaveApplication(_ rewarded: VungleRewarded) {
    func rewardedAdDidRewardUser(_ rewarded: VungleRewarded) {
    func rewardedAdWillClose(_ rewarded: VungleRewarded) {
    func rewardedAdDidClose(_ rewarded: VungleRewarded) {

Test a Rewarded Ad

You can test a rewarded ad in one of two ways: by setting your app status to Test Mode so that Vungle can deliver test ads to your app, or by adding a test device to your app so that Vungle can deliver test ads specifically to the test device. Follow the instructions in Test Your Integration: Test Mode and Test Devices.

Additional Resources


Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?