This function depends on the services provide by the Petal Ads SDK. The SDK may collect personal data of users. Before using this function in a quick app, inform the users that personal data will be collected and guide them to read the privacy statement.
This document describes only API definitions. For details about how and when to call these APIs, please refer to Integrating Ads Kit.
Add the following configuration to the features attribute in the manifest.json file:
{"name": "service.ad"} Add the following configuration to the script element on the page where the API will be called:
import ad from '@service.ad'
Or
var ad = require("@service.ad") Item | Description |
|---|---|
Applicable devices | Mobile phones and tablets |
Applicable regions | Global |
API | Description |
|---|---|
Obtains the service provider, for example, the English brand name of the vendor. | |
Consent APIs | |
Requests user consent updates. | |
Sets the tag for users under the age of consent. | |
Sets consent status. | |
Sets whether to process ad requests according to the Children's Online Privacy Protection Act (COPPA). | |
Sets whether to process ad requests as directed to users under the age of consent. | |
ad.setAdContentClassification(string adContentClassification) | Sets the maximum ad content rating. |
Sets whether to request non-personalized ads. | |
Native Ads APIs | |
Creates a native ad. If a native ad has been created before, the API returns the created ad. | |
Obtains ad data. | |
Reports ad impressions. The data is reported for each ad only once. The adId field is in the ad data obtained by using the load method. | |
Reports ad taps. The data is reported for each ad only once. The adId field is in the ad data obtained by using the load method. | |
Sets the callback function for successful ad loading. | |
Removes listening to successful native ad loading. | |
Listens to native ad error events. | |
Removes listening to native ad loading errors. | |
Sets whether to process ad requests according to the COPPA. | |
nativeAd.setTagForUnderAgeOfPromise(number underAgeOfPromiseStr) | Sets whether to process ad requests as directed to users under the age of consent. |
nativeAd.setAdContentClassification(string adContentClassification) | Sets the maximum ad content rating. |
Sets whether to request non-personalized ads. | |
Obtains the download progress. | |
Obtains the download status. | |
Listens to download status changes. | |
Cancels listening to download status changes. | |
Listens to download progress changes. | |
Cancels listening to download progress changes. | |
Destroys a native ad. | |
Rewarded Ads APIs | |
Creates a rewarded ad. | |
Manually obtains ads for updating. | |
Displays ads. The rewarded ad component is hidden by default. | |
Sets the callback function for successful ad loading. | |
Removes listening to successful loading of a rewarded ad. | |
Listens to rewarded ad closing events. A rewarded ad can be closed only by a user. | |
Removes listening to rewarded ad closing events. | |
Listens to rewarded ad loading error events. | |
Removes listening to rewarded ad loading error events. | |
rewardedVideoAd.setTagForChildProtection(number childProtection) | Sets whether to process ad requests according to the COPPA. |
rewardedVideoAd.setTagForUnderAgeOfPromise(number underAgeOfPromiseStr) | Sets whether to process ad requests as directed to users under the age of consent. |
rewardedVideoAd.setAdContentClassification(string adContentClassification) | Sets the maximum ad content rating. |
Sets whether to request non-personalized ads. | |
Destroys a rewarded ad. | |
Banner Ads APIs | |
Creates a banner ad. If a banner ad has been created before, the API returns the created ad. | |
Loads and displays a banner ad. | |
Hides a banner ad. | |
Listens to banner ad error events. | |
Removes listening to banner ad error events. | |
Listens to banner ad loading events. | |
Removes listening to banner ad loading events. | |
Listens to banner ad closing events. | |
Removes listening to banner ad closing events. | |
Destroys a banner ad. | |
Interstitial Ad APIs | |
Creates an interstitial ad. | |
Loads an interstitial ad. | |
Displays an interstitial ad. | |
Listens to interstitial ad loading events. | |
Removes listening to interstitial ad loading events. | |
Listens to interstitial ad error events. | |
Removes listening to interstitial ad error events. | |
Listens to interstitial ad closing events. | |
Removes listening to interstitial ad closing events. | |
Listens to interstitial ad tap events. | |
Removes listening to interstitial ad tap events. | |
Destroys an interstitial ad. | |
Description
Obtains the service provider, for example, the English brand name of the vendor.
Returns
Character string, which is the code of the service provider (for example, the English brand name of the vendor), is returned. If the service does not exist, an empty string is returned. If so, do not call other APIs of the service. Otherwise, an exception will occur.
Sample code
ad.getProvider();
Description
Requests user consent updates.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
success | function | No | Called upon a success in requesting user consent updates. |
fail | function | No | Called upon a failure in requesting user consent updates. |
complete | function | No | Callback upon completion. |
Parameters in the success callback
Parameter | Type | Description |
|---|---|---|
consentStatus | number | Consent status.
|
isNeedConsent | boolean | Indicates whether user consent is required.
|
AdProviderList | array | Ad technology provider information list. For details about the AdProvider structure, please refer to AdProvider parameters. |
AdProvider parameters
Parameter | Description |
|---|---|
id | ID of an ad technology provider. |
name | Name of an ad technology provider. |
serviceArea | Service area of an ad technology provider. |
privacyPolicyUrl | URL of the privacy policy of an ad technology provider. |
Sample code
ad.requestConsentUpdate({
success: function(data) {
console.log('requestConsentUpdate success data ' + JSON.stringify(data))
},
fail: function(data) {
console.log('requestConsentUpdate fail data ' + JSON.stringify(data))
},
complete: function() {},
}) Description
Sets the tag for users under the age of consent.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
underAgeOfPromise | boolean | Yes |
|
Sample code
ad.setUnderAgeOfPromise(true)
Description
Sets consent status.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
consentStatus | number | Yes | User consent.
|
Sample code
ad.setConsentStatus(1)
Description
Sets whether to process ad requests according to the COPPA.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
childProtection | number | Yes | Indicates whether to process ad requests according to the COPPA.
|
Sample code
ad.setTagForChildProtection(1)
Description
Sets whether to process ad requests as directed to users under the age of consent.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
underAgeOfPromiseStr | number | Yes | Setting directed to users under the age of consent.
|
Sample code
ad.setTagForUnderAgeOfPromise(1)
Description
Sets the maximum ad content rating.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adContentClassification | string | Yes | Ad content rating.
|
Sample code
ad.setAdContentClassification('W') Description
Sets whether to request non-personalized ads.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
personalizedAd | number | Yes | Indicates whether to request non-personalized ads.
|
Sample code
ad.setNonPersonalizedAd(1)
Description
Creates a native ad. If a native ad has been created before, the API returns the created ad.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adUnitId | string | Yes | Native ad unit ID. |
Returns
Native ad.
Sample code
let nativeAd = ad.createNativeAd({
adUnitId: 'xxx',
}) Description
Obtains ad data. If data obtaining is successful, onLoad is called back. If it fails, onError is called back.
Currently, Huawei returns one ad data record each time it calls the API.
Description
Reports ad impressions. The data is reported for each ad only once. The adId field is in the ad data obtained by using the load method.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adId | string | Yes | Ad ID, which is returned by the onload callback. |
Sample code
nativeAd.reportAdShow({
adId: "xxx"
}) Description
Reports ad taps. The data is reported for each ad only once. The adId field is in the ad data obtained by using the load method.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adId | string | Yes | Ad ID, which is returned by the onload callback. |
Description
Sets the callback function for successful ad loading.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | Yes | Function that is triggered after an ad is loaded. The callback data is the ad list object {adList: xxx}. |
Parameter | Type | Description |
|---|---|---|
adList | array | Ad details. For details, please refer to Ad item description. |
Ad item description
Parameter | Type | Description |
|---|---|---|
adId | string | Ad ID, which is used to report impressions and taps. |
title | string | Ad title. |
appName(1106+) | string | App name. |
appVersion(1106+) | string | App version number. |
appPermissionUrl(1106+) | string | App permission link. |
appPrivacyUrl(1106+) | string | App privacy policy link. |
appCompany(1106+) | string | App developer name. |
desc | string | Ad description. |
source (1077+) | string | Ad source. |
icon | string | Icon of a promoted app. |
imgUrlList | array | List of image URLs. |
videoUrlList | array | List of video URLs. |
videoRatio (1078+) | array | Ad video aspect ratio. |
logoUrl | string | Ad tag image. NOTE: Currently, Huawei returns only an empty string "". |
clickBtnTxt | string | Text on the tapped button. |
creativeType | number | Ad type.
NOTE: The options are different from those of vendor alliance. |
interactionType | number | Interaction type after an ad is tapped.
NOTE: Currently, the return value is fixed at 0. |
Sample code
nativeAd.onLoad((data) => {
console.info('ad data loaded: ' + JSON.stringify(data))
this.adItemData = data.adList[0]
}) Description
Removes listening to successful native ad loading.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | No | Callback object to be removed. NOTE: Currently, Huawei does not support the removal of a callback object. This parameter can be left empty to remove all callback objects. |
Description
Listens to native ad error events.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | Yes | Function that is triggered when an error occurs during ad loading. The callback data is an object containing the error code and error information. |
callback parameters
Parameter | Type | Description |
|---|---|---|
errCode | number | |
errMsg | string | Error information. |
Result Code | Description |
|---|---|
1001 | Invalid parameter. |
1002 | Invalid ad unit. |
1003 | Internal error. |
1004 | No suitable ad found. |
1100 | Related APIs are called too frequently. |
1102 | An unsupported method is called. |
1104 | Network error. |
2000 | Unknown error. |
Sample code
nativeAd.onError((e) => {
console.error('load ad error:' + JSON.stringify(e));
const errCode = e.errCode
const errMsg = e.errMsg
}) Description
Removes listening to native ad loading errors.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | No | Callback object to be removed. NOTE: Currently, Huawei does not support the removal of a callback object. This parameter can be left empty to remove all callback objects. |
Description
Sets whether to process ad requests according to the COPPA. You are advised to use the ad.setTagForChildProtection(number childProtection) API instead.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
childProtection | number | Yes | Indicates whether to process ad requests according to the COPPA.
|
Sample code
nativeAd.setTagForChildProtection(1)
Description
Sets whether to process ad requests as directed to users under the age of consent. You are advised to use the ad.setTagForUnderAgeOfPromise(number underAgeOfPromiseStr) API instead.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
underAgeOfPromiseStr | number | Yes | Setting directed to users under the age of consent.
|
Sample code
nativeAd.setTagForUnderAgeOfPromise(1)
Description
Sets the maximum ad content rating. You are advised to use the ad.setAdContentClassification(string adContentClassification) API instead.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adContentClassification | string | Yes | Ad content rating.
|
Sample code
nativeAd.setAdContentClassification('W') Description
Sets whether to request non-personalized ads. You are advised to use the ad.setNonPersonalizedAd(number personalizedAd) API instead.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
personalizedAd | number | Yes | Indicates whether to request non-personalized ads.
|
Sample code
nativeAd.setNonPersonalizedAd(1)
Description
Obtains the download progress.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adId | string | Yes | Ad ID, which is returned by the onload callback. |
Returns
App download progress. The value is of the number type and ranges from 0 to 100.
Sample code
const progress = nativeAd.getDownloadProgress({
adId: "xxx"
})
console.log('getDownloadProgress progress = ' + progress); Description
Obtains the download status.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adId | string | Yes | Ad ID, which is returned by the onload callback. |
Returns
App download status. The value is of the string type. The options are described as follows.
Value | Type | Description |
|---|---|---|
DOWNLOAD | string | App download has not started. This is the initial app status. |
DOWNLOADING | string | App download is in progress. |
DOWNLOADFAILED | string | Download fails. |
WAITING | string | App download is in waiting state. |
PAUSE | string | App download is paused. |
INSTALL | string | App installation is in waiting state. |
INSTALLING | string | The app is being installed. |
INSTALLED | string | App installation is complete. The app can be launched. |
Sample code
const status = nativeAd.getAppStatus({
adId: "xxx"
})
console.log('getAppStatus status = ' + status ); Description
Listens to download status changes.
This method must be called in nativeAd.onLoad. Otherwise, the download status cannot be listened.
Parameters
Parameter | Type | Description |
|---|---|---|
status | string | App download status. |
uniqueId | string | Unique ID of an app. |
Sample code
nativeAd.onStatusChanged((data) => {
console.log('onStatusChanged data = ', data)
}) Description
Cancels listening to download status changes.
Sample code
nativeAd.offStatusChanged()
Description
Listens to download progress changes.
This method must be called in nativeAd.onLoad. Otherwise, the download progress cannot be listened.
Parameters
Parameter | Type | Description |
|---|---|---|
progress | number | Download progress. The value ranges from 0 to 100. |
uniqueId | string | Unique ID of an app. |
Sample code
nativeAd.onDownloadProgress((data) => {
console.log('onDownloadProgress data = ', data)
}) Description
Cancels listening to download progress changes.
Sample code
nativeAd.offDownloadProgress()
Description
Creates a rewarded ad. If an ad has been created for the passed adUnitId, the existing object is reused. Then ad assets will be loaded. A singleton is returned, which is valid only for the current screen.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adUnitId | string | Yes | ID of a rewarded ad unit. |
Returns
Rewarded ad.
Sample code
let rewardedVideoAd = ad.createRewardedVideoAd({
adUnitId: 'xxx'
}) Description
Manually obtains an ad to refresh. If the ad is successfully obtained, resolved Promise is called back. If the ad fails to be obtained, onError is called back.
If requests are sent too frequently, onError may be called back.
Description
Displays ads. The rewarded ad is hidden by default. onError is called back for a call failure.
Description
Sets the callback function for successful ad loading.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | Yes | Function that is triggered after an ad is loaded. |
Sample code
rewardedVideoAd.onLoad(() => {
console.log('ad loaded.')
}) Description
Removes listening to successful loading of a rewarded ad.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | No | Callback object to be removed. Note: Huawei does not support the removal of a callback object currently. This parameter can be left empty to remove all callback objects. |
Sample code
rewardedVideoAd.offLoad(() => {
console.log('ad off loaded.')
}) Description
Listens to rewarded ad closing events. A rewarded ad can be closed only by a user.
Parameters
Parameter | Type | Description |
|---|---|---|
callback | function | Function that is triggered after an ad is closed. The callback parameter is {isEnded: xxx}. |
Parameter | Type | Description |
|---|---|---|
isEnded | boolean | Indicates whether a rewarded ad is closed after a user watches it completely.
|
Sample code
rewardedVideoAd.onClose((res) => {
console.log('ad onClose: ' + res.isEnded)
}) Description
Removes listening to rewarded ad closing events.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | No | Callback object to be removed. NOTE: Currently, Huawei does not support the removal of a callback object. This parameter can be left empty to remove all callback objects. |
Description
Listens to rewarded ad loading error events.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | Yes | Function that is triggered when an error occurs during ad loading. The callback data is an object containing the error code and error information. |
Callback parameters
Parameter | Type | Description |
|---|---|---|
errCode | number | Error code. |
errMsg | string | Error information. |
Sample code
rewardedVideoAd.onError((e) => {
console.error('load ad error:' + JSON.stringify(e));
const errCode = e.errCode
const errMsg = e.errMsg
}) Description
Removes listening to rewarded ad loading error events.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
callback | function | No | Callback object to be removed. Note: Huawei does not support the removal of a callback object currently. This parameter can be left empty to remove all callback objects. |
Description
Sets whether to process ad requests according to the COPPA.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
childProtection | number | Yes | Indicates whether to process ad requests according to the COPPA.
|
Sample code
rewardedVideoAd.setTagForChildProtection(1)
Description
Sets whether to process ad requests as directed to users under the age of consent.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
underAgeOfPromiseStr | number | Yes | Setting directed to users under the age of consent.
|
Sample code
rewardedVideoAd.setTagForUnderAgeOfPromise(1)
Description
Sets the maximum ad content rating.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adContentClassification | string | Yes | Ad content rating.
|
Sample code
rewardedVideoAd.setAdContentClassification('W') Description
Sets whether to request non-personalized ads.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
personalizedAd | number | Yes | Indicates whether to request personalized ads.
|
Sample code
rewardedVideoAd.setNonPersonalizedAd(1)
Description
Creates a banner ad. If a banner ad has been created before, the API returns the created ad.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adUnitId | string | Yes | Banner ad unit ID. |
style | object | Yes | Style of the banner ad. For details, please refer to style parameters. |
adIntervals | number | No | Interval for automatically refreshing an ad, in seconds. The value ranges from 30 to 120. The recommended value is 60. If this parameter is not passed, banner ads will not be automatically refreshed. This parameter is valid only when the API is called for the first time, unless the banner ad is destroyed using bannerAd.destroy() and created again. |
style parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
top | number | Yes | Vertical coordinate of the upper left corner of the banner ad. |
left | number | Yes | Horizontal coordinate of the upper left corner of the banner ad. |
width | number | Yes | Width of the banner ad, in dp. |
height | number | Yes | Height of the banner ad, in dp. |
The following table describes the restrictions on the width and height of the ad.
Width | Height | Description |
|---|---|---|
360 | 57 | Common banner ads, applicable to 1080 x 170 px ad assets. |
360 | 144 | Large banner ads, applicable to 1080 x 432 px ad assets. |
160 | 600 | Not supported in the Chinese mainland. |
300 | 250 | Not supported in the Chinese mainland. |
320 | 100 | Not supported in the Chinese mainland. |
320 | 50 | Not supported in the Chinese mainland. |
468 | 60 | Not supported in the Chinese mainland. |
728 | 90 | Not supported in the Chinese mainland. |
-1 | -2 | The ad width and height automatically adapt to the screen size. |
Returns
Banner ad. You can use bannerAd.style to obtain the actual width and height of an ad. The response parameters are described as follows.
Parameter | Type | Description |
|---|---|---|
top | number | Vertical coordinate of the upper left corner of the banner ad. |
left | number | Horizontal coordinate of the upper left corner of the banner ad. |
width | number | Width of the banner ad, in dp. |
height | number | Height of the banner ad, in dp. |
realWidth | number | Actual width of the banner ad, in px. |
realHeight | number | Actual height of the banner ad, in px. |
Sample code
let bannerAd = ad.createBannerAd({
adUnitId: 'testw6vs28auh3',
style:{
top:20,
left:20,
height:57,
width:360
}
}) Description
Loads and displays a banner ad. When an error occurs, onError is called back. When the loading is successful, onLoad is called back.
Description
Listens to banner ad error events.
Returns
Object type.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
errMsg | string | Yes | Error information. |
errCode | number | Yes | Error code. |
Sample code
bannerAd.onError((err)=>{
console.log(err)
}) Description
Listens to banner ad size change events. (This function is not implemented currently.)
Description
Removes listening to banner ad size change events. (This function is not implemented currently.)
Description
Creates an interstitial ad. If an interstitial ad has been created before, the API returns the created ad.
Parameters
Parameter | Type | Mandatory | Description |
|---|---|---|---|
adUnitId | string | Yes | Interstitial ad slot ID. |
Sample code
let interstitialAd = ad.createInterstitialAd({
adUnitId: 'xxxx'
}) Description
Obtains the interstitial ad data. If data is obtained, onLoad is called back. If data is not obtained, onError is called back.
Sample code
interstitialAd.load();
Description
Displays an interstitial ad.
Returns
Promise, which indicates the operation result.
Sample code
interstitialAd.show().then(
() => { console.log('Success') },
() => { console.log('Failure') }
) Description
Sets the callback function for successful interstitial ad loading.
Sample code
interstitialAd.onLoad(function (data) {
console.log('onLoad data ' + JSON.stringify(data));
}); Description
Removes listening to interstitial ad loading events.
Sample code
interstitialAd.offLoad();
Description
Listens to interstitial ad error events.
Returns
Object type.
Parameter | Type | Description |
|---|---|---|
errMsg | string | Error information. |
errCode | number | Error code. |
Sample code
interstitialAd.onError((err)=>{
console.log(err)
}) Description
Removes listening to interstitial ad error events.
Sample code
interstitialAd.offError();
Description
Listens to interstitial ad closing events.
Sample code
interstitialAd.onClose(()=>{
console.log('interstitialAd closed');
}) Description
Removes listening to interstitial ad closing events.
Sample code
interstitialAd.offClose();
Description
Listens to interstitial ad tap events.
Sample code
interstitialAd.onClick(()=>{
console.log('interstitialAd clicked');
}) Description
Removes listening to interstitial ad tap events.
Sample code
interstitialAd.offClick();
Description
Destroys an interstitial ad.
Sample code
interstitialAd.destroy()
An error code is the error information obtained through onError.
Error Code | Description |
|---|---|
200 | General error. |
202 | Invalid parameter. |
1000 | Call failed due to a backend error. |
1001 | The ad request is invalid due to specific causes, such as not setting the ad unit ID or invalid banner ad size. |
1002 | The banner ad has expired or the banner ad task has been removed. |
1003 | Internal error. |
1004 | The ad request is sent successfully, but the server returns a response indicating no available ad assets. |
1005 | The ad component is being reviewed. |
1006 | The ad component is rejected. |
1007 | The ad function is disabled. |
1008 | The ad function of the ad slot is disabled. |
1100 | The ad is being requested and cannot be requested again. |
1101 | The ad is not displayed for a long time after being loaded. The ad information has expired. |
1102 | The API version is not supported by the HMS Core Ads SDK. |
1103 | Failed to monitor the environment. For example, the app has no permission. |
1104 | The ad request fails due to a network connection error. |
1105 | Failed to load the ad. |
1106 | Failed to display the ad. |
2000 | The HMS Core (APK) version does not support the setting of AppInfo. |
Before submitting an ad for review, perform self-check on the ad based on the following rules:
[Incorrect] Request the ad again in onError after the failure. If onError is called back each time, the request-fail-request cycle starts.
[Recommended] Do not send a request again regardless of whether the request succeeds or fails. The service can have one more try only for rewarded ads.
[Incorrect] Display the same global ad on multiple pages.
[Recommended] The ad object on each page is independent. You need to use the createXX method to create ads and register a callback.
[Recommended] Add a delay of several seconds or minutes before calling the show API in the onLoad callback.
The delay cannot exceed one hour. Otherwise, the ad is regarded as invalid and will not be charged.
[Incorrect] When a native ad is clicked for multiple times, only one click event is reported.
[Incorrect] Only one impression event is reported when the native ad is displayed for multiple times. For example, when an ad is displayed for the first time, the reportAdShow API is called to report the ad. When a user switches from another page to the ad page, the ad is still displayed, but no impression event is reported.
[Recommended] When a user switches from another page to the ad page and the native ad is still displayed, the impression event needs to be reported again. Generally, this logic is processed in the page lifecycle function onShow.
Ad Format | Test Ad Unit ID | Display Form | Dimensions | Promotion Type |
|---|---|---|---|---|
Splash | testq6zq98hecj | Image | 1080 x 1620 | Web page |
q6zq98hecj | Image | 1920 x 1080 | Web page | |
n7p4mh57xs | Image | 1080 x 1620 | App engagement | |
q1h4mvd5a3 | Image | 1080 x 1620 | App download | |
testd7c5cewoj6 | Video | 720 x 1280 | Web page | |
Native | testu7m3hc4gvm | Large image | 1080 x 607 | Web page |
i7ik1b3mgg | Large image | 1080 x 607 | App engagement | |
a5sz2rxpaj | Large image | 1080 x 607 | App download | |
u7m3hc4gvm | Large image | 1080 x 607 | App download | |
r6w14o0hqz | Three images | 225 x 150 | App download | |
testb65czjivt9 | Small image | 225 x 150 | App download | |
b65czjivt9 | Small image | 225 x 150 | App download | |
testy63txaom86 | Video | 640 x 360 | App download | |
y63txaom86 | Video | 640 x 360 | App download | |
j79gukslrn | Image | 160*160 | App download | |
Rewarded | u2k89ub7vq | Video | 640 x 360 | Web page |
e7hm5vx799 | Video | 640 x 360 | App download | |
testx9dtjwj8hp | Video | 720 x 1080 | App download | |
Banner | x0kvs12iu6 | Image | 1080 x 170 | App download |
testw6vs28auh3 | Image | 1080 x 170 | App download | |
Interstitial | testb4znbuh3n2 | Video | 720 x 1080 | Web page |
t3u4pks711 | Video | 640 x 360 | App download | |
l7s7x17w20 | Video | 1280 x 720 | App download | |
g2tz5d4wkv | Video | 720 x 1280 | App download |