Help Center/Details/

Rewarded Video Ads

Introduction

Incentive video is a full-screen video advertisement. Users can get rewards after watching the complete video. After the video advertisement is played, the end page will be displayed to guide the user to follow-up actions. The current form of rewarded video ads is: Endcard page is displayed after the video is played, interactive page is displayed after the video is played, or interactive ads appear directly.

Supported ad sizes: Full screen horizontal screen (aspect ratio 16:9), full screen vertical screen (aspect ratio 9:16)

Permission

**Template rendering incentive video: **Open by default
SDK rendering rewarded video: has been recycled, no longer available for creation

Code bit ID creation parameter description:

-The developer selects the video playback direction according to the display scene: horizontal or vertical
-The reward name and reward quantity can be set according to the needs of your own project, for example: the reward name is gold coins, the reward quantity: 1000
-Reward distribution settings:
-When choosing not to require server judgment, developers can issue rewards based on the client's nativeExpressRewardedVideoAdServerRewardDidSucceed callback.
-When choosing to require server judgment, the developer needs to develop the interface according to the following requirements and fill in the callback URL on the platform.
Server callback means that when the user reaches the reward conditions after watching the incentive video, the CSJ server will send a verification request to the developer server. After receiving the request, the developer server will determine whether to reward the user and return it to the CSJ server true/ false, the client will give the nativeExpressRewardedVideoAdServerRewardDidSucceed callback in the end, and the developer will issue the rewards according to the callback, or issue the rewards through the server interface verification result.

Reward distribution mechanism

Refer to this document for reward distribution logic: Link

Server callback description

The server-to-server callback allows you to determine whether to provide rewards to users who watch the ad. When the user has successfully watched the advertisement, a verification request will be sent to the verification interface that you configured in the CSJ platform, and the developer will determine whether the user will be rewarded for this viewing.
Key Note: The CSJ server only transmits the verification request transparently, and does not add verification logic in the intermediate process. In order to protect the interests of developers and user experience, developers can add their own verification logic in the verification process.

Callback method description

The CSJ server will request the callback link of the third-party service by GET method, and splicing the following parameters to return:

user_id=%s&trans_id=%s&reward_name=%s&reward_amount=%d&extra=%s&sign=%s
Field Definition Field Name Field Type Remarks
sign Signature string Signature
user_id tagid string Call SDK to pass through
trans_id Transaction id string The unique transaction ID that completed the watch
reward_amount reward amount int media platform configuration
reward_name reward name string media platform configuration
extra Extra string Call the SDK to pass in and pass it through, or empty if not needed

Signature generation method:

appSecurityKey: The key transId you get from the newly created reward video code bit on the CSJ media platform: transaction id: sign = sha256(appSecurityKey:transId)
Python example:

import hashlib
if __name__ == "__main__":
    trans_id = "6FEB23ACB0374985A2A52D282EDD5361u6643"
    app_security_key = "7ca31ab0a59d69a42dd8abc7cf2d8fbd"
    check_sign_raw = "%s:%s"% (app_security_key, trans_id)
    sign = hashlib.sha256(check_sign_raw).hexdigest()

Return to the agreement:

Return json data, the fields are as follows:

Field Definition Field Name Field Type Remarks
isValid Verification result BOOL Judgment result, whether to issue reward

Examples of callback URL format are as follows:

{
   "isValid": true
}

Notice:

The server callback mode is not necessary. The server mode only adds a third-party server verification and judgment, and the specific rewards are issued by the client.

Template Rewarded Video Ads

Instructions for use

The template rewarded video uses the BUNativeExpressRewardedVideoAd object to call the loadAdData method to request an advertisement, and the BUNativeExpressRewardedVideoAd object to call showAdFromRootViewController: to display the advertisement, and to obtain the advertisement and display by setting the BUNativeExpressRewardedVideoAdDelegate agent , Click, close and other callbacks.

Create an ad slot object and request an ad

BUNativeExpressRewardedVideoAd

You need to pass in the ad slot object when requesting an ad, and the ad slot ID must be passed in when the ad slot object is created

Required parameters:

Field Definition Field Name Field Type Remarks
SlotID Ad Slot NSString Code Slot ID
userId tag_id NSString tag_id

Optional incoming parameters:

Field Definition Field Name Field Type Remarks
rewardName Reward Name NSString Set according to project requirements
rewardAmount Reward Amount NSInteger Set according to project needs
extra Transmission parameters NSString Should be the string after json serialization

Use BUNativeExpressRewardedVideoAd to create an object, use BUNativeExpressRewardedVideoAd to call loadAdDat to request ads

 BURewardedVideoModel *model = [[BURewardedVideoModel alloc] init];
 model.userId = @"tag123";
 self.rewardedAd = [[BUNativeExpressRewardedVideoAd alloc] initWithSlotID:slotID rewardedVideoModel:model];
 self.rewardedAd.delegate = self;
 // optional
    self.rewardedAd.rewardPlayAgainInteractionDelegate = self.expressRewardedVideoAgainDelegateObj;
 [self.rewardedAd loadAdData];

Receive ads loading results

BUNativeExpressRewardedVideoAdDelegate

Callback Method Notes
nativeExpressRewardedVideoAd:didFailWithError The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
nativeExpressRewardedVideoAdViewRenderFail:error Rendering failed, the rendering failed due to network or hardware reasons, you can change the mobile phone or network environment to test. It is recommended to upgrade to the latest version of the CSJ platform
nativeExpressRewardedVideoAdDidLoad Creative material loaded successfully
nativeExpressRewardedVideoAdDidDownLoadVideo Video download completed

BUNativeExpressRewardedVideoAdDelegate callback description

Callback Method Notes
nativeExpressRewardedVideoAdDidLoad: Callback entry to prove that the advertising material has been successfully loaded
nativeExpressRewardedVideoAd: didFailWithError: This callback method can locate the error code corresponding to the specific failure reason, and just print the error. Please see the link for details of all error codes. Link
nativeExpressRewardedVideoAdCallback:withType: This callback can know the type of advertisement of the template rewarded video
nativeExpressRewardedVideoAdDidDownLoadVideo It is recommended to display ads in this callback method to ensure smooth playback and smooth display, and a better user experience.
nativeExpressRewardedVideoAdViewRenderSuccess: Rendering success callback. SDK version after 3100, callback will not occur until the ad is displayed
nativeExpressRewardedVideoAdViewRenderFail: Rendering failure, network or hardware reasons cause rendering failure, you can replace the mobile phone or network environment test. It is recommended to upgrade to the latest version of the CSJ platform
nativeExpressRewardedVideoAdWillVisible: Template rewarded video ads will be displayed soon
nativeExpressRewardedVideoAdDidVisible: The template rewarded video ad has been displayed
nativeExpressRewardedVideoAdWillClose: Template rewarded video ads will be closed soon
nativeExpressRewardedVideoAdDidClose: This callback is triggered when the user closes the ad. Note: Any closing operation of the ad must be triggered by the user;
nativeExpressRewardedVideoAdDidClick: Click callback method
nativeExpressRewardedVideoAdDidClickSkip: Skip callback method
nativeExpressRewardedVideoAdDidPlayFinish: This callback method can be triggered when the normal playback of the video is completed. This callback method will not be entered when the advertisement playback is abnormal;
nativeExpressRewardedVideoAdServerRewardDidSucceed: Asynchronously requested server verification success callback. Developers need to issue rewards in this callback. Now includes two verification methods: 1. C2C requires server verification 2. S2S does not require server authentication. nativeExpressRewardedVideoAdServerRewardDidFail: The server verification failed callback for asynchronous request. You can print error in this callback method to locate the specific reason for the failure, or locate the specific reason by capturing the packet. The capture address: https://domain name or ip address/api/ad/union/sdk/get_ads/ Provide the returned data Confirm) Go to [Message Feedback]-[Technical Questions Entry (Technical Questions only support this entry for the time being)] to give feedback, and the relevant students will handle it for you
nativeExpressRewardedVideoAdDidCloseOtherController:interactionType: This callback is called when the ad jumps to another controller and the controller is closed. InteractionType: This parameter can be distinguished from the opened appstore/webpage/video ad details page

nativeExpressRewardedVideoAdServerRewardDidSucceed callback description:

  1. The nativeExpressRewardedVideoAdServerRewardDidSucceed callback only verifies the video playback status or progress without the user server reward verification. If the video playback is 90% or the playback fails due to an abnormal player, the CSJ will call back nativeExpressRewardedVideoAdServerRewardDidSucceed, and the return result is true.
  2. In the case of using server-side reward verification, the nativeExpressRewardedVideoAdServerRewardDidSucceed callback returns the result of the developer's server-side verification.

To sum up: nativeExpressRewardedVideoAdServerRewardDidSucceed callback is only a result of the video playback status or the result returned by the developer, and does not represent advertising business indicators such as whether the playback is billed or not.

By setting the BUNativeExpressRewardedVideoAdDelegate agent, get the callback of the click, close, and play completion of the advertisement. For other delegate methods, please refer to BUDExpressRewardedVideoViewController class #pragma mark-BUNativeExpressRewardedVideoAdDelegate

Display ads

Rewarded video advertisements need to allow users to actively choose to watch and give users a choice. Users cannot be forced to watch rewarded video advertisements. After the advertisement is played, the user needs to be rewarded accordingly.
Call the showAdFromRootViewController: method to display rewarded video ads, where the currently displayed page needs to be passed in. Be sure to set the rootViewController, which is the viewController needed to display ads and jump landing pages

Show rewarded video ads

//WKWebview will be rendered during show. It is recommended to display up to three ads at a time. If there are more than 3, it will cause WKWebview rendering to fail. Of course, under normal circumstances, only one incentive video will be shown at a time
-(void)showRewardVideoAd {
    if (self.rewardedAd) {
        [self.rewardedAd showAdFromRootViewController:self];
    }
}

Timing

After receiving the nativeExpressRewardedVideoAdDidDownLoadVideo callback, the user is allowed to watch the advertisement, which can ensure smooth playback and smooth display, and a better user experience.

-(void)nativeExpressRewardedVideoAdDidDownLoadVideo:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
 //Ads are displayed after this callback method to ensure smooth playback and smooth display, and a better user experience.
}

Reload the ad after the ad is shown

The ads of the same request can only be counted for one impression at most, and repeated impressions will be filtered by the system. Therefore, it is recommended that developers set the original ad object to nil in the nativeExpressRewardedVideoAdDidClose callback after the user has watched the ad to ensure that the ad object is the new request object

-(void)nativeExpressRewardedVideoAdDidClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
//In this callback method, the advertisement can be blanked
}

Precautions

  1. **RootViewController must be set up to handle ad jumps. All jumps in the SDK use the present method. Please ensure that the incoming rootViewController cannot be empty and no other controllers are presented, otherwise the presentedViewController will already exist and the presentation will fail. **
  2. If you choose the server callback method, please make sure that userId is of type NSString and is not empty, and make sure that the format of the callback URL is
{
    "isValid": true
}
  1. The nativeExpressRewardedVideoAdViewRenderSuccess rendering success callback is after the ad is displayed
  2. In order to ensure smooth playback and smooth display, and a better user experience, the advertisement will be displayed after receiving the nativeExpressRewardedVideoAdDidDownLoadVideo callback
  3. The extra transparent transmission parameter should be a string after json serialization, make sure it is not empty
  4. To judge whether the advertisement is valid, just use self.rewardedAd to judge. The isAdValid field is currently obsolete, please do not use this field to determine whether the ad is valid
  5. Personalized template ads In order to optimize the display speed, local templates will be used, and relevant data will be intercepted when requesting. If the access party is using the H5 page to send the request, the request body will be cleared, and other logic will remain unchanged. If you use body transmission Please change to other methods. For example: jsBridge method.
  6. The closing operation of the advertisement must be triggered by the user actively, and the client cannot perform the forced closing operation at the code level

resource

For detailed access, please refer to the BUDExpressRewardedVideoViewController class in the Demo. For the advertisement loading request part, please refer to the loadRewardVideoAdWithSlotID method, and for the advertisement display part, please refer to the showRewardVideoAd method.

SDK rendering rewarded video ads

Instructions for use

The SDK renders rewarded videos using the BURewardedVideoAd object to call the loadAdData method to request advertisements, and the BURewardedVideoAd object to call showAdFromRootViewController: to display advertisements, and to obtain the advertisements by setting the BURewardedVideoAdDelegate agent. Display, click, close and other callbacks.

Create an ad slot object and request an ad

BURewardedVideoAd

You need to pass in the ad slot object when requesting an ad, and the ad slot ID must be passed in when the ad slot object is created

Every time you need to generate a new BURewardedVideoAd object, call the loadAdData method to request the latest rewarded video, please do not reuse the local cached rewarded video for multiple display

Required parameters:

Field Definition Field Name Field Type Remarks
SlotID Ad Slot NSString Code Slot ID
userId tag_id NSString tag_id

Optional incoming parameters:

Field Definition Field Name Field Type Remarks
rewardName Reward Name NSString Set according to project requirements
rewardAmount Reward Amount NSInteger Set according to project needs
extra Pass-through parameter NSString should be a string after json serialization, only a single json object format is supported, and json objects cannot be nested

Use BURewardedVideoAd to create an object, use BURewardedVideoAd to call loadAdData to request ads

//Ensure that the advertising object requested each time is a new advertising object, and avoid reusing the same object for advertising requests
BURewardedVideoModel *model = [[BURewardedVideoModel alloc] init];
model.userId = @"tag123";
self.rewardedVideoAd = [[BURewardedVideoAd alloc] initWithSlotID:slotID rewardedVideoModel:model];
self.rewardedVideoAd.delegate = self;
// optional
    self.rewardedVideoAd.rewardPlayAgainInteractionDelegate = self.rewardedVideoAgainDelegateObj;
[self.rewardedVideoAd loadAdData];

Receive ads loading results

BURewardedVideoAdDelegate

Callback Method Notes
rewardedVideoAd:didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
rewardedVideoAdDidLoad: Successfully loaded creative materials
rewardedVideoAdVideoDidLoad: Video download completed

BURewardedVideoAdDelegate callback description

Callback Method Notes
rewardedVideoAdDidLoad: Material loading success callback
rewardedVideoAd: didFailWithError: Load failed callback
rewardedVideoAdVideoDidLoad: Video download success callback, it is recommended to display advertisements in this callback method to ensure smooth display of advertisements and better user experience.
rewardedVideoAdWillVisible: When the ad is about to be displayed, it will enter this callback method
rewardedVideoAdDidVisible: When the ad has been displayed, it will enter this callback method
rewardedVideoAdWillClose: When the ad is about to be closed, it will enter this callback method
rewardedVideoAdDidClose: Close callback, when the advertisement is closed, the related logic can be carried out in this callback
Handle the rewardedVideoAdDidClick: When the ad is clicked, it will enter this callback method
rewardedVideoAdDidPlayFinish:didFailWithError: This callback will be entered when the ad playback is completed or an error occurs, just print the error. Please see the link for details of all error codes. Link
rewardedVideoAdServerRewardDidSucceed: verify: Asynchronous request server verification success callback
rewardedVideoAdServerRewardDidFail: Asynchronously requested server verification failure callback
rewardedVideoAdServerRewardDidFail: error: Asynchronous request server verification failure callback, this callback method can print the failure reason, that is, print error. Please see the link for details of all error codes. Link
rewardedVideoAdDidClickSkip: Click to skip the callback (this function needs to be applied separately, cpm is negatively affected)
rewardedVideoAdCallback: withType: This callback can know the ad type of the rewarded video

By setting the BURewardedVideoAdDelegate agent, get the callback of the click, close, and play completion of the advertisement. For other proxy methods, please refer to BUDRewardedVideoAdViewController class#pragma mark-BURewardedVideoAdDelegate

Display ads

Rewarded video advertisements need to allow users to actively choose to watch and give users a choice. Users cannot be forced to watch rewarded video advertisements. After the advertisement is played, the user needs to be rewarded accordingly.

Call the showAdFromRootViewController: method to display rewarded video ads, where the currently displayed page needs to be passed in. Be sure to set the rootViewController, which is the viewController needed to display ads and jump landing pages

Show rewarded video ads

-(void)showRewardVideoAd {
  if (self.rewardedVideoAd) {
     [self.rewardedVideoAd showAdFromRootViewController:self];
   }
 }

Timing

Allow users to watch the advertisement after receiving the callback of rewardedVideoAdVideoDidLoad, which can ensure smooth playback and smooth display, and a better user experience.

-(void)rewardedVideoAdVideoDidLoad:(BURewardedVideoAd *)rewardedVideoAd {
   //Ads are displayed after this callback method, which can ensure smooth playback and smooth display, and a better user experience.
}

Reload the ad after the ad is shown

The ads of the same request can only be counted for one impression at most, and repeated impressions will be filtered by the system. Therefore, it is recommended that developers set the original ad object to nil in the rewardedVideoAdDidClose callback after the user has watched the ad to ensure that the ad object is the new request object

-(void)rewardedVideoAdDidClose:(BURewardedVideoAd *)rewardedVideoAd {
//You can set the advertising object to nil in this callback
}

Precautions

  1. rootViewController must be set to handle ad jumps. All jumps in the SDK are presented in the way of presentation. Please make sure that the incoming rootViewController cannot be empty and no other controllers are presented, otherwise it will appear that the presentedViewController already exists and the presentation will fail.
  2. If you choose the server callback method, please make sure that userId is of type NSString and not empty, and make sure that the format of the callback URL is
{
    "isValid": true
}
  1. In order to ensure smooth playback and smooth display, and a better user experience, the advertisement will be displayed after receiving the rewardedVideoAdVideoDidLoad callback
  2. The extra transparent transmission parameter should be json serialized string, make sure it is not empty
  3. To judge whether the advertisement is valid, just use self.rewardedAd to judge. The isAdValid field is currently obsolete, please do not use this field to determine whether the ad is valid
  4. The closing operation of the advertisement must be triggered by the user actively, and the client cannot perform the forced closing operation at the code level

resource

For detailed access, please refer to the BUDRewardedVideoAdViewController class in Demo, the advertisement loading request part can refer to the loadRewardVideoAdWithSlotID: method, and the advertisement display part can refer to the showRewardVideoAd method.

Did the content solve your problem?
Contact us