tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Ad

PDF
Focus Mode
Font Size
Last updated: 2025-04-10 16:37:38

wx.createRewardedVideoAd

wx.createRewardedVideoAd(Object object)

Feature description:Creates a rewarded video ad component. The rewarded video ad created by calling this method is a singleton (a global singleton in a mini game, and a singleton within a page in a mini program. The singleton object in the mini program cannot be used across pages.)
Parameter: Object object.
Property
Type
Default value
‍Required
Description
adUnitId
string
-
True
Ad unit ID.
multiton
boolean
-
False
Whether to enable multiple-instance mode. Default: false.
Return value:RewardedVideoAd.Rewarded video ad component.

RewardedVideoAd

Rewarded video ad component. The rewarded video ad is a native component with a higher level than regular components. Each rewarded video ad is a singleton, which is hidden by default and you need to call RewardedVideoAd.show() to display it.

Method

RewardedVideoAd.load()

Feature description:Loads a rewarded video ad.
Return value:Promise. The result of loading data for a rewarded video ad.

RewardedVideoAd.show()

Feature description:Displays a rewarded video ad. The rewarded video ad will slide up from the bottom of the screen.
Return value:Promise, the result of displaying the rewarded video ad.

RewardedVideoAd.destroy()

Feature description:Destroys a rewarded video ad instance.

RewardedVideoAd.onLoad(function listener)

Feature description:Listens for the rewarded video ad loading event.
Parameter: function listener. The listener for the rewarded video ad loading event.

RewardedVideoAd.offLoad(function listener)

Feature description:Removes the listener for the rewarded video ad loading event.
Parameter: function listener. The listener that was passed to onLoad. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onLoad(listener)
RewardedVideoAd.offLoad(listener) // Must pass the same function object used in onLoad

RewardedVideoAd.onError(function listener)

Feature description:Listens for rewarded video error events.
Parameter: function listener. The listener for rewarded video error events.
Return parameter: Object res.
Property
Type
Description
errMsg
string
Error information.
errCode
number
Error code.

RewardedVideoAd.offError(function listener)

Feature description:Removes the listener for rewarded video error events.
Parameter: function listener. The listener that was passed to onError. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onError(listener)
RewardedVideoAd.offError(listener) // Must pass the same function object used in onError

RewardedVideoAd.onClose(function listener)

Feature description:Listens for the event when a user taps the close button.
Parameter: function listener. The listener for the event when a user taps the close button.
Return parameter: Object res.
Property
Type
Description
isEnded
boolean
Indicates whether the video was closed after being fully watched by the user.

RewardedVideoAd.offClose(function listener)

Feature description:Removes the listener for the event when a user taps the close button.
Parameter: function listener. The listener that was passed to onClose. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onClose(listener)
RewardedVideoAd.offClose(listener) // Must pass the same function object used in onClose

wx.createBannerAd

wx.createBannerAd(Object object)

Feature description:Creates a banner ad component. Each time this method is called to create a banner ad, a new instance is returned.
Parameter: Object object.
Property
Type
Default value
‍Required
Description
adUnitId
string
-
True
Ad unit ID.
style
Object
-
True
The style of the banner ad component.
The value of style is as follows:
Property
Type
Default value
‍Required
Description
left
number
-
True
The top-left X coordinate of the banner ad component.
top
number
-
True
The top-left Y coordinate of the banner ad component.
width
number
-
True
The width of the banner ad component.
height
number
-
True
The height of the banner ad component.
Return value:BannerAd.A banner ad component.

BannerAd

The banner ad component, which is a native component with a higher level than regular components. The banner ad component is hidden by default and you need to call BannerAd.show() to display it. The banner ad will be scaled proportionally to the width set by the developer, and the scaled size will be provided using the BannerAd.onResize() event.

Property

Object style
The style of the banner ad component. The values of the style properties represent only the developer-defined settings. The banner ad will be scaled proportionally to the width set by the developer, and the scaled size will be provided using the BannerAd.onResize() event.
Property
Type
Description
left
number
The top-left X coordinate of the banner ad component.
top
number
The top-left Y coordinate of the banner ad component.
width
number
The width of the banner ad component. The minimum value is 300 px, and the maximum value is the screen width (obtained using wx.getSystemInfoSync()).
height
number
The height of the banner ad component.
realWidth
number
The actual width of the banner ad component after proportional scaling.
realHeight
number
The actual height of the banner ad component after proportional scaling.

Method

BannerAd.show()

Feature description:Shows a banner ad.
Return value: Promise. The result of displaying the rewarded video ad.

BannerAd.hide()

Feature description:Hides a banner ad.

BannerAd.destroy()

Feature description:Destroy a banner ad.

BannerAd.onResize(function listener)

Feature description:Listens for the banner ad size change event.
Parameter: function listener. The listener for the banner ad size change event.
Return parameter: Object res.
Property
Type
Description
width
number
Scaled width.
height
number
Scaled height.

BannerAd.offResize(function listener)

Feature description:Removes the listener for the banner ad size change event.
Parameter: function listener. The listener that was pass to onResize. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

BannerAd.onResize(listener)
BannerAd.offResize(listener) // Must pass the same function object used in onResize

BannerAd.onLoad(function listener)

Feature description:Listens for the banner ad loading event.
Parameter: function listener. The listener for the banner ad loading event.

BannerAd.offLoad(function listener)

Feature description:Removes the listener for the banner ad loading event.
Parameter: function listener. The listener that was passed to onLoad. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

BannerAd.onLoad(listener)
BannerAd.offLoad(listener) // Must pass the same function object used in onLoad

BannerAd.onError(function listener)

Feature description:Listens for banner ad error events.
Parameter: function listener. The listener for banner ad error events.
Return parameter: Object res.
Property
Type
Description
errMsg
string
Error information.
errCode
number
Error code.

BannerAd.offError(function listener)

Feature description:Removes the listener for banner ad error events.
Parameter: function listener. The listener that was passed to onError. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

BannerAd.onError(listener)
BannerAd.offError(listener) // Must pass the same function object used in on Error

Error code

Error codes are obtained through the onError event. During debugging, you can capture error details via exception returns. You can add appropriate monitoring information to assist in troubleshooting issues in the live environment.
Error code.
Description
Reason
1000
Failed to call the backend API
This error is not caused by the developer.
1001
Parameter error
Incorrect usage.
1002
Invalid ad unit
Incorrect ad unit ID spelling or accidental use of another app's ad unit ID.
1003
Internal error
This error is not caused by the developer.
1004
No suitable ad
Ads do not appear every time; this time it might not appear because there are no ads that match the user's preferences.
1010
Ad feature disabled
The ad feature has been disabled.



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback