diff --git a/_includes/mobile/rewarded-server-side-configuration.md b/_includes/mobile/rewarded-server-side-configuration.md new file mode 100644 index 0000000000..12ce47d281 --- /dev/null +++ b/_includes/mobile/rewarded-server-side-configuration.md @@ -0,0 +1,72 @@ +##### Server-side Rewarded Ad Unit Configuration + +The Rewarded Ad Unit assumes special behavior that should be configurable by the platform or publisher according to the application or ad experience guides. + +Configuration of rewarded ad unit can be done by defining the Prebid Server [passthrough extension](https://docs.prebid.org/prebid-server/endpoints/openrtb2/pbs-endpoint-auction.html#request-passthrough) or by using a stored impression-level request on the server. + +Prebid SDK will search for a particular `rwdd` object in `$.seatbid.bid.ext.prebid.passthrough` of bid response to configure the behavior and rendering of the Rewarded Ad Unit. The following table describes the structure and usage purpose of `rwdd` configuration parameters. + +{: .table .table-bordered .table-striped } +| Attribute | Type | Description | Example | +|-----------|------|-------------|---------| +| `reward` | object
(optional) | Metadata provided by the publisher to describe the reward. |{
 "type": "SuperDollars",
 "count": 10
}
| +| `reward.type` | string | Type of the reward in the app's coins. | `"SuperDollars"` | +| `reward.count` | integer | Amount of coins. | `10` | +| `reward.ext` | object | For future extensions. | {
 "ext": {}
}
| +| `completion` | object
(optional) | Describes the condition when the SDK should send a signal to the app that the user has earned the reward. |{
 "video": {
  "endcard": {
   "time": 5
   }
  }
}
| +| `completion.banner` | object | Details for banner ad completion. |{
 "time": 5,
 "event": "custom_event_url"
}
| +| `completion.banner.time` | integer | Period of time the banner ad is on screen. | `5` | +| `completion.banner.event` | string | URL with custom schema sent by the creative to indicate that the user did earn a reward. | `"rwdd://userDidEarnReward"` | +| `completion.video` | object | Details for video ad completion. |{
 "endcard": {
  "time": 5
 }
}
| +| `completion.video.time` | integer | Period of time the video ad is on screen. | `10` | +| `completion.video.playbackevent` | string | The playback event stage in the video. | `"start"`, `"firstquartile"`, `"midpoint"`, `"thirdquartile"`, `"complete"` | +| `completion.video.endcard` | object | Properties for the end card. |{
 "time": 5
}
| +| `completion.video.endcard.time` | integer | Period of time the end card is on screen. | `5` | +| `completion.video.endcard.event` | string | URL with custom schema sent by the creative for end card. | `"rwdd://userDidEarnReward"` | +| `close` | object
(optional) | Describes the ad close behavior after the reward is earned. |{
 "postrewardtime": 3,
 "action": "autoclose"
}
| +| `close.postrewardtime` | integer | Time interval (seconds) after reward event when SDK should close interstitial. | `3` | +| `close.action` | string | Action SDK should make: `"autoclose"` (close interstitial) or `"closebutton"` (show close button) | `"autoclose"` | + + +An example of an impression-level stored request: + +```json +{ + "video": { + "h": 480, + "w": 320, + "mimes": ["video/mp4"], + "linearity": 1, + "placement": 2, + "playbackmethod": [2] + }, + "ext": { + "prebid": { + "passthrough": [ + { + "type": "prebidmobilesdk", + "rwdd": { + "reward": { + "type": "SuperDollars", + "count": 10 + }, + "completion": { + "video": { + "endcard": { + "time": 5 + } + } + }, + "close": { + "postrewardtime": 3, + "action": "autoclose" + } + } + } + ] + } + } +} +``` + +More details about the SDK behavior according to the `rwdd` configuration you can find in the [GitHub Proposal](https://github.com/prebid/prebid-mobile-ios/pull/1058). diff --git a/prebid-mobile/modules/rendering/android-sdk-integration-admob.md b/prebid-mobile/modules/rendering/android-sdk-integration-admob.md index 32cc4169c5..077b9acb7b 100644 --- a/prebid-mobile/modules/rendering/android-sdk-integration-admob.md +++ b/prebid-mobile/modules/rendering/android-sdk-integration-admob.md @@ -186,9 +186,11 @@ Now you should just make a regular AdMob's ad request. Evetything else will be h Once you receive the ad it will be ready for display. You can show interstitial right in the listener or later according to the app logic. -### Rewarded Video +### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example ```kotlin // 1. Create AsRequest @@ -230,32 +232,32 @@ adUnit?.fetchDemand { result -> } ``` -#### Step 1: Create AdRequest +##### Step 1: Create AdRequest {:.no_toc} This step is the same as for the original [AdMob integration](https://developers.google.com/admob/android/rewarded). You don't have to make any modifications here. -#### Step 2: Create AdMobRewardedMediationUtils +##### Step 2: Create AdMobRewardedMediationUtils {:.no_toc} The `AdMobRewardedMediationUtils` is a helper class, which performs certain utilty work for the `MediationInterstitialAdUnit`, like passing the targeting keywords to adapters. -#### Step 3: Create MediationRewardedVideoAdUnit +##### Step 3: Create MediationRewardedVideoAdUnit {:.no_toc} The `MediationRewardedVideoAdUnit` is part of the prebid mediation API. This class is responsible for making bid request and managing the winning bid. -#### Step 4: Make a bid request +##### Step 4: Make a bid request {:.no_toc} The `fetchDemand` method makes a bid request to the prebid server and provides a result in a completion handler. -#### Step 5: Make an ad request +##### Step 5: Make an ad request {:.no_toc} Now you should just make a regular AdMob's ad request. Evetything else will be handled by GMA SDK and prebid adapters. -#### Step 6: Display an ad +##### Step 6: Display an ad {:.no_toc} Once you receive the ad it will be ready for display. You can show interstitial right in the listener or later according to the app logic. diff --git a/prebid-mobile/modules/rendering/android-sdk-integration-gam.md b/prebid-mobile/modules/rendering/android-sdk-integration-gam.md index 65d8d95b61..4b682a501d 100644 --- a/prebid-mobile/modules/rendering/android-sdk-integration-gam.md +++ b/prebid-mobile/modules/rendering/android-sdk-integration-gam.md @@ -215,9 +215,13 @@ Integration: 4. Remove the original `InterstitialAdUnit`. 5. Follow the instructions to integrate [Interstitial API](#interstitials). -### Rewarded Video +### Rewarded -To display a Rewarded Ad follow these steps: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example + +Displaying the **Rewarded Ad** is the same as displaying an Interstitial Ad, but it adds ability to handle reward. To display a Rewarded Ad follow these steps: ```kotlin // 1. Create a rewarded custom event handler for GAM ad server. @@ -243,21 +247,7 @@ Pay attention that the `loadAd()` should be called on the main thread. {% endcapture %} {% include /alerts/alert_warning.html content=warning_note %} -Displaying the **Rewarded Ad** is the same as displaying an Interstitial Ad. The type of ad can be customized to: - -Be notified when user earns a reward - implement `RewardedAdUnitListener` interface: - -```kotlin - fun onUserEarnedReward(rewardedAdUnit: RewardedAdUnit) -``` - -When the actual reward object is stored in the `RewardedAdUnit`: - -```kotlin -val reward = rewardedAdUnit.getUserReward() -``` - -#### Step 1: Create Event Handler +##### Step 1: Create Event Handler {:.no_toc} GAM's event handlers are special containers that wrap the GAM Ad Views and help to manage collaboration between GAM and Prebid views. @@ -266,7 +256,7 @@ GAM's event handlers are special containers that wrap the GAM Ad Views and help To create an event handler you should provide a GAM Ad Unit. -#### Step 2: Create Rewarded Ad Unit +##### Step 2: Create Rewarded Ad Unit {:.no_toc} **RewardedAdUnit** - is an object that will load and display the particular ad. To create it you should provide @@ -276,12 +266,12 @@ To create an event handler you should provide a GAM Ad Unit. You can also assign the listener for processing ad events. -#### Step 3: Load the Ad +##### Step 3: Load the Ad {:.no_toc} Call the `loadAd()` method to make a bid request. The ad unit will load an ad and will wait for explicit instructions to display the Rewarded Ad. -#### Step 4: Display the Ad when it is ready +##### Step 4: Display the Ad when it is ready {:.no_toc} The most convenient way to determine if the ad is ready for displaying is to listen for the listener method: @@ -292,7 +282,23 @@ override fun onAdLoaded(rewardedAdUnit: RewardedAdUnit) { } ``` -### Migrating rewarded video from a Bidding-Only integration +##### Step 5: Handle a reward +{:.no_toc} + +Handle earning the reward in the appropriate method. Important: a reward can be null. + +```kotlin +override fun onUserEarnedReward(rewardedAdUnit: RewardedAdUnit?, reward: Reward?) { + if (reward != null) { + val rewardType = reward.type + val rewardCount = reward.count + val rewardExt = reward.ext + // Process the reward + } +} +``` + +#### Migrating rewarded video from a Bidding-Only integration {:.no_toc} GAM setup: @@ -306,7 +312,7 @@ Integration: 1. Replace the `RewardedAd` with `RewardedAdUnit`. 2. Implement the interface for `RewardedAdUnitListener`. 3. Remove the original `RewardedVideoAdUnit`. -4. Follow the instructions to integrate [Rewarded API](#rewarded-video). +4. Follow the instructions to integrate [Rewarded API](#rewarded). ## Additional Ad Unit Configuration diff --git a/prebid-mobile/modules/rendering/android-sdk-integration-max.md b/prebid-mobile/modules/rendering/android-sdk-integration-max.md index 2a5803b2c1..e05a58c7df 100644 --- a/prebid-mobile/modules/rendering/android-sdk-integration-max.md +++ b/prebid-mobile/modules/rendering/android-sdk-integration-max.md @@ -161,9 +161,11 @@ Now you should make a regular MAX's ad request. Everything else will be handled Once you receive the ad it will be ready for display. Folow the [MAX instructions](https://dash.applovin.com/documentation/mediation/android/getting-started/interstitials#showing-an-interstitial-ad) about how to do it. -### Rewarded Video +### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example ```kotlin // 1. Get an instance of MaxRewardedAd @@ -192,35 +194,36 @@ The way of displaying the rewarded ad is the same as for the Interstitial Ad. To be notified when user earns a reward follow the [MAX intructions](https://dash.applovin.com/documentation/mediation/android/getting-started/rewarded-ads#accessing-the-amount-and-currency-for-a-rewarded-ad). -#### Step 1: Get an instance of MaxRewardedAd +##### Step 1: Get an instance of MaxRewardedAd {:.no_toc} This step is totally the same as for original [MAX integration](https://dash.applovin.com/documentation/mediation/android/getting-started/rewarded-ads). You don't have to make any modifications here. -#### Step 2: Create MaxMediationRewardedUtils +##### Step 2: Create MaxMediationRewardedUtils {:.no_toc} The `MaxMediationRewardedUtils` is a helper class, which performs certain utilty work for the `MediationRewardedVideoAdUnit`, like passing the targeting keywords to the adapters. -#### Step 3: Create MediationRewardedVideoAdUnit +##### Step 3: Create MediationRewardedVideoAdUnit {:.no_toc} The `MediationRewardeVideoAdUnit` is part of the prebid mediation API. This class is responsible for making a bid request and providing a winning bid and targeting keywords to the adapters. -#### Step 4: Make bid request +##### Step 4: Make bid request {:.no_toc} The `fetchDemand` method makes a bid request to the prebid server and provides a result in a completion handler. -#### Step 5: Make an Ad Reuest +##### Step 5: Make an Ad Reuest {:.no_toc} Now you should make a regular MAX's ad request. Everything else will be handled by GMA SDK and prebid adapters. -#### Steps 6: Display an ad +##### Steps 6: Display an ad {:.no_toc} Once the rewarded ad is received you can display it. Folow the [MAX instructions](https://dash.applovin.com/documentation/mediation/android/getting-started/rewarded-ads#showing-a-rewarded-ad) for the details. + ### Native Ads Integration example: diff --git a/prebid-mobile/modules/rendering/android-sdk-integration-pb.md b/prebid-mobile/modules/rendering/android-sdk-integration-pb.md index 6c4a24cadc..e0405e31c8 100644 --- a/prebid-mobile/modules/rendering/android-sdk-integration-pb.md +++ b/prebid-mobile/modules/rendering/android-sdk-integration-pb.md @@ -192,9 +192,11 @@ override fun onAdLoaded(interstitialAdUnit: InterstitialAdUnit) { } ``` -#### Rewarded Video +#### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +##### Integration example ``` kotlin // 1. Create an Ad Unit @@ -215,19 +217,19 @@ Pay attention that the `loadAd()` should be called on the main thread. {% endcapture %} {% include /alerts/alert_warning.html content=warning_note %} -##### Step 1: Create a Rewarded Ad Unit +###### Step 1: Create a Rewarded Ad Unit {:.no_toc} Create the `RewardedAdUnit` object with parameters: - `adUnitId` - an ID of Stored Impression on the Prebid server. -##### Step 2: Load the Ad +###### Step 2: Load the Ad {:.no_toc} Call the `loadAd()` to make a bid request. -##### Step 3: Show the Ad when it is ready +###### Step 3: Show the Ad when it is ready {:.no_toc} Wait until the ad is loaded and present it to the user in any suitable time. @@ -238,6 +240,22 @@ override fun onAdLoaded(rewardedAdUnit: RewardedAdUnit) { } ``` +##### Step 4: Handle a reward +{:.no_toc} + +Handle earning a reward in the appropriate method. Important: a reward can be null. + +```kotlin +override fun onUserEarnedReward(rewardedAdUnit: RewardedAdUnit?, reward: Reward?) { + if (reward != null) { + val rewardType = reward.type + val rewardCount = reward.count + val rewardExt = reward.ext + // Process the reward + } +} +``` + ## Further Reading - [Prebid Mobile Overview](/prebid-mobile/prebid-mobile) diff --git a/prebid-mobile/modules/rendering/ios-sdk-integration-admob.md b/prebid-mobile/modules/rendering/ios-sdk-integration-admob.md index acc6d0bb43..a7e6076466 100644 --- a/prebid-mobile/modules/rendering/ios-sdk-integration-admob.md +++ b/prebid-mobile/modules/rendering/ios-sdk-integration-admob.md @@ -168,9 +168,11 @@ Make a regular AdMob's ad request. Everything else will be handled by GMA SDK an Once you receive the ad it will be ready for display. Follow the [AdMob instructions](https://developers.google.com/admob/ios/interstitial#swift) for displaying an ad. -### Rewarded Video +### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example ```swift // 1. Create GADRequest @@ -210,27 +212,27 @@ The process of displaying the rewarded ad is the same as for displaying an Inter To be notified when a user earns a reward follow the [AdMob intructions](https://developers.google.com/admob/ios/rewarded#show_the_ad). -#### Step 1: Create GADRequest +##### Step 1: Create GADRequest {:.no_toc} This step is the same as for the original [AdMob integration](https://developers.google.com/admob/ios/rewarded). You don't have to make any modifications here. -#### Step 2: Create MediationRewardedAdUnit +##### Step 2: Create MediationRewardedAdUnit {:.no_toc} The `AdMobMediationRewardedUtils` is a helper class, which performs certain utilty work for the `MediationRewardedAdUnit`, like passing the targeting keywords to the adapters. -#### Step 3: Create MediationInterstitialAdUnit +##### Step 3: Create MediationInterstitialAdUnit {:.no_toc} The `MediationRewardedAdUnit` is part of the Prebid mediation API. This class is responsible for making a bid request and providing a winning bid and targeting keywords to the adapters. -#### Step 4: Make bid request +##### Step 4: Make bid request {:.no_toc} The `fetchDemand` method makes a bid request to the a Prebid server and provides a result in a completion handler. -#### Step 5: Make an Ad Request +##### Step 5: Make an Ad Request {:.no_toc} Make a regular AdMob's ad request. Everything else will be handled by GMA SDK and prebid adapters. diff --git a/prebid-mobile/modules/rendering/ios-sdk-integration-gam.md b/prebid-mobile/modules/rendering/ios-sdk-integration-gam.md index a4d09983f5..bd9aca4c98 100644 --- a/prebid-mobile/modules/rendering/ios-sdk-integration-gam.md +++ b/prebid-mobile/modules/rendering/ios-sdk-integration-gam.md @@ -183,7 +183,7 @@ Call the method `loadAd()` which will make a bid request to Prebid Server. Wait for the Prebid Server to return an ad and show it to the user in any suitable time. ```swift -// MARK: InterstitialRenderingAdUnitDelegate +// MARK: InterstitialAdUnitDelegate func interstitialDidReceiveAd(_ interstitial: InterstitialAdUnit) { // Now the ad is ready for display @@ -206,17 +206,18 @@ Integration: 4. Remove original `InterstitialAdUnit`. 5. Follow the instructions to integrate [Interstitial API](#interstitials). -### Rewarded Video +### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example ```swift // 1. Create an Event Handler let eventHandler = GAMRewardedEventHandler(adUnitID: GAM_AD_UNIT_ID) // 2. Create an Ad Unit -rewardedAd = RewardedAdUnit(configID: CONFIG_ID, - eventHandler: eventHandler) +rewardedAd = RewardedAdUnit(configID: CONFIG_ID, eventHandler: eventHandler) rewardedAd.delegate = self @@ -237,23 +238,15 @@ The proccess for displaying the Rewarded Ad is the same as for the Interstitial To be notified when a user earns a reward - implement the method of `RewardedAdUnitDelegate`: ```swift -- (void)rewardedAdUserDidEarnReward:(RewardedAdUnit *)rewardedAd; +func rewardedAdUserDidEarnReward(_ rewardedAd: RewardedAdUnit, reward: PrebidReward) {} ``` -The reward object is stored in the `RewardedAdUnit`: - -```swift -if let reward = rewardedAd.reward as? GADAdReward { - // ... -} -``` - -#### Step 1: Create Event Handler +##### Step 1: Create Event Handler {:.no_toc} To create an event handler you should provide a **GAM Ad Unit ID**. -#### Step 2: Create Rewarded Ad Unit +##### Step 2: Create Rewarded Ad Unit {:.no_toc} Create the `RewardedAdUnit` object with parameters: @@ -261,12 +254,12 @@ Create the `RewardedAdUnit` object with parameters: - `configID` - an ID of Stored Impression on the Prebid server - `eventHandler` - the instance of rewarded event handler -#### Step 3: Load the Ad +##### Step 3: Load the Ad {:.no_toc} Call the `loadAd()` method which will make a bid request to Prebid server. -#### Step 4: Show the Ad when it is ready +##### Step 4: Show the Ad when it is ready {:.no_toc} Wait for the ad to load and display it to the user in any suitable time. @@ -279,6 +272,23 @@ func rewardedAdDidReceiveAd(_ rewardedAd: RewardedAdUnit) { } ``` +###### Step 4: Handle the reward +{:.no_toc} + +Handle the reward in the appropriate method. + +``` swift +// MARK: RewardedAdUnitDelegate + +func rewardedAdUserDidEarnReward(_ rewardedAd: RewardedAdUnit, reward: PrebidReward) { + let type = reward.type + let count = reward.count + let ext = reward.ext + + // Process the reward +} +``` + #### Migrating Rewarded Video from a Bidding-Only integration GAM setup: @@ -293,7 +303,7 @@ Integration: 2. Implement the protocol `RewardedAdUnitDelegate` in the View Controller. 3. Remove usage of `GAMRequest`. 4. Remove original `RewardedVideoAdUnit`. -5. Follow the instructions to integrate [Rewarded API](#rewarded-video). +5. Follow the instructions to integrate [Rewarded API](#rewarded). ## Additional Ad Unit Configuration diff --git a/prebid-mobile/modules/rendering/ios-sdk-integration-max.md b/prebid-mobile/modules/rendering/ios-sdk-integration-max.md index 9145836090..1a4a63ee3a 100644 --- a/prebid-mobile/modules/rendering/ios-sdk-integration-max.md +++ b/prebid-mobile/modules/rendering/ios-sdk-integration-max.md @@ -148,9 +148,11 @@ Now you should make a regular MAX's ad request. Everything else will be handled Once you receive the ad it will be ready for display. Follow the [MAX instructions](https://dash.applovin.com/documentation/mediation/ios/getting-started/interstitials#showing-an-interstitial-ad) for displaying an ad. -### Rewarded Video +### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +#### Integration example ```swift // 1. Get an instance of MARewardedAd @@ -176,32 +178,32 @@ The process for displaying the rewarded ad is the same as for displaying the Int To be notified when a user earns a reward follow the [MAX intructions](https://dash.applovin.com/documentation/mediation/ios/getting-started/rewarded-ads#loading-a-rewarded-ad). -#### Step 1: Get an instance of MARewardedAd +##### Step 1: Get an instance of MARewardedAd {:.no_toc} This step is the same as for the original [MAX integration](https://dash.applovin.com/documentation/mediation/ios/getting-started/rewarded-ads). You don't have to make any modifications here. -#### Step 2: Create MAXMediationRewardedUtils +##### Step 2: Create MAXMediationRewardedUtils {:.no_toc} The `MAXMediationRewardedUtils` is a helper class, which performs certain utilty work for the `MediationRewardedAdUnit`, like passing the targeting keywords to the adapters. -#### Step 3: Create MediationRewardedAdUnit +##### Step 3: Create MediationRewardedAdUnit {:.no_toc} The `MediationRewardedAdUnit` is a part of the Prebid Mediation API. This class is responsible for making a bid request and providing a winning bid and targeting keywords to the adapters. -#### Step 4: Make bid request +##### Step 4: Make bid request {:.no_toc} The `fetchDemand` method makes a bid request to the Prebid Server and provides a result in a completion handler. -#### Step 5: Make an Ad Reuest +##### Step 5: Make an Ad Reuest {:.no_toc} Make a regular MAX's ad request. Everything else will be handled by GMA SDK and prebid adapters. -#### Steps 6: Display an ad +##### Steps 6: Display an ad {:.no_toc} Once the rewarded ad is received you can display it. Follow the [MAX instructions](https://dash.applovin.com/documentation/mediation/ios/getting-started/rewarded-ads#showing-a-rewarded-ad) for the details. diff --git a/prebid-mobile/modules/rendering/ios-sdk-integration-pb.md b/prebid-mobile/modules/rendering/ios-sdk-integration-pb.md index 5291655c9d..c52ec93119 100644 --- a/prebid-mobile/modules/rendering/ios-sdk-integration-pb.md +++ b/prebid-mobile/modules/rendering/ios-sdk-integration-pb.md @@ -150,16 +150,16 @@ if interstitial.isReady { ``` -The **default** ad format for interstitial is **.banner**. In order to make a `multiformat bid request`, set the respective values into the `adFormats` property. +The **default** ad formats for interstitial are **.banner** and **video**. In order to make a banner-only or video-only request, set the respective values into the `adFormats` property. ``` swift // Make bid request for video ad adUnit?.adFormats = [.video] -// Make bid request for both video and banner ads +// Make bid request for both video and banner ads (default behaviour) adUnit?.adFormats = [.video, .banner] -// Make bid request for banner ad (default behaviour) +// Make bid request for banner ad adUnit?.adFormats = [.banner] ``` @@ -192,9 +192,11 @@ func interstitialDidReceiveAd(_ interstitial: InterstitialRenderingAdUnit) { } ``` -#### Rewarded Video +#### Rewarded -Integration example: +{% include mobile/rewarded-server-side-configuration.md %} + +##### Integration example ``` swift // 1. Create an Ad Unit @@ -212,28 +214,54 @@ if rewardedAd.isReady { } ``` -##### Step 1: Create Rewarded Ad Unit +###### Step 1: Create Rewarded Ad Unit {:.no_toc} -Create the `RewardedAdUnit` object with parameter: +Create the `RewardedAdUnit` object with the parameter: - `configID` - an ID of Stored Impression on the Prebid Server -##### Step 2: Load the Ad +You can also customize ad unit by setting additional properties: + +- `adFormats` - the set of ad formats supported by the ad unit(the default value is `[.banner, .video]` formats); +- `bannerParameters` - the banner parameters used for configuring ad unit; +- `videoParameters` - the video parameters used for configuring ad unit. + +###### Step 2: Load the Ad {:.no_toc} Call the `loadAd()` method which will make a bid request to Prebid server. -##### Step 3: Show the Ad when it is ready +###### Step 3: Show the Ad when it is ready {:.no_toc} -Wait until the ad will be loaded and present it to the user in any suitable time. +Wait until the ad is loaded and present it to the user at any suitable time. ``` swift // MARK: RewardedAdUnitDelegate func rewardedAdDidReceiveAd(_ rewardedAd: RewardedAdUnit) { - // Now the ad is ready for display + // Now the ad is ready for display - call `show` method. + if rewardedAd.isReady { + rewardedAd.show(from: self) + } +} +``` + +###### Step 4: Handle the reward +{:.no_toc} + +Handle the reward in the appropriate method. + +``` swift +// MARK: RewardedAdUnitDelegate + +func rewardedAdUserDidEarnReward(_ rewardedAd: RewardedAdUnit, reward: PrebidReward) { + let type = reward.type + let count = reward.count + let ext = reward.ext + + // Process the reward } ``` diff --git a/prebid-mobile/modules/rendering/modules-rendering.md b/prebid-mobile/modules/rendering/modules-rendering.md index 9d82a5efd6..6b1f2cab98 100644 --- a/prebid-mobile/modules/rendering/modules-rendering.md +++ b/prebid-mobile/modules/rendering/modules-rendering.md @@ -17,7 +17,6 @@ Starting with `1.14.0-beta1` Prebid mobile supports integration with **AdMob**. Starting with `2.0.0` Prebid mobile supports integration with **AppLovin MAX**. - ## Supported Ad Formats Prebid Mobile rendering supports the following ad formats: @@ -26,7 +25,5 @@ Prebid Mobile rendering supports the following ad formats: * Video Banner * Display Interstitial * Video Interstitial -* Rewarded Video - - - +* Display Rewarded +* Video Rewarded diff --git a/prebid-mobile/pbm-api/android/code-integration-android.md b/prebid-mobile/pbm-api/android/code-integration-android.md index c741512ac8..d052606119 100644 --- a/prebid-mobile/pbm-api/android/code-integration-android.md +++ b/prebid-mobile/pbm-api/android/code-integration-android.md @@ -383,7 +383,8 @@ In the table below, you can find Prebid's test IDs that are used in the Demo App |`prebid-demo-video-interstitial-320-480-original-api`|**Video Interstitial** (Original API)|Returns a stored response that contains a Video Interstitial 320x480 winning bid.| |`prebid-demo-video-interstitial-320-480`|**Video Interstitial** (Rendering API)|Returns a stored response that contains a Video Interstitial 320x480 winning bid.| |`prebid-demo-video-rewarded-320-480-original-api`|**Rewarded Video** (Original API)|Returns a stored response that contains a Rewarded Video 320x480 winning bid.| -|`prebid-demo-video-rewarded-320-480`|**Rewarded Video** (Original API)|Returns a stored response that contains a Rewarded Video 320x480 winning bid.| +|`prebid-demo-banner-rewarded-time`|**Rewarded HTML** Returns a stored response that contains a Rewarded HTML 320x480 winning bid with rewarded configuration.|| +|`prebid-demo-video-rewarded-endcard-time`|**Rewarded Video** Returns a stored response that contains a Rewarded Video 320x480 winning bid with rewarded configuration.|| |`sample_video_response`|**Instream Video**|Returns a stored response that contains a Video 320x480 winning bid. Note: on Android we have an [issue](https://github.com/prebid/prebid-mobile-android/issues/517) with Instream Video demo example. When it is fixed the config id will be updated to the new one.| |`prebid-demo-banner-native-styles`|**Native Styles**|Returns a stored response that contains a Native winning bid.| |`prebid-demo-banner-native-styles`|**In-App Native**|Returns a stored response that contains a Native winning bid.| diff --git a/prebid-mobile/pbm-api/ios/code-integration-ios.md b/prebid-mobile/pbm-api/ios/code-integration-ios.md index c8d2f08932..1893297357 100644 --- a/prebid-mobile/pbm-api/ios/code-integration-ios.md +++ b/prebid-mobile/pbm-api/ios/code-integration-ios.md @@ -364,7 +364,8 @@ In the table below, you can find Prebid's test IDs that are used in the Demo App |`prebid-demo-video-interstitial-320-480-original-api`|**Video Interstitial** (Original API)|Returns a stored response that contains a Video Interstitial 320x480 winning bid.| |`prebid-demo-video-interstitial-320-480`|**Video Interstitial** (Rendering API)|Returns a stored response that contains a Video Interstitial 320x480 winning bid.| |`prebid-demo-video-rewarded-320-480-original-api`|**Rewarded Video** (Original API)|Returns a stored response that contains a Rewarded Video 320x480 winning bid.| -|`prebid-demo-video-rewarded-320-480`|**Rewarded Video** (Original API)|Returns a stored response that contains a Rewarded Video 320x480 winning bid.| +|`prebid-demo-banner-rewarded-time`|**Rewarded HTML** Returns a stored response that contains a Rewarded HTML 320x480 winning bid with rewarded configuration.|| +|`prebid-demo-video-rewarded-endcard-time`|**Rewarded Video** Returns a stored response that contains a Rewarded Video 320x480 winning bid with rewarded configuration.|| |`prebid-demo-video-interstitial-320-480`|**Instream Video**|Returns a stored response that contains a Video 320x480 winning bid.| |`prebid-demo-banner-native-styles`|**Native Styles**|Returns a stored response that contains a Native winning bid.| |`prebid-demo-banner-native-styles`|**In-App Native**|Returns a stored response that contains a Native winning bid.|