The WeChat applet introduces the advertising space function, detailed steps! ! !

Everyone has encountered the advertisement page that appears at the beginning of the home page loading. This kind of WeChat officially provides an API for setting. Let's explain it in detail below.

First of all, the first step requires that the cumulative number of users of the mini program reaches 1000 to activate the traffic host. After successfully opening the traffic host, you can create the corresponding advertising space, including banner ads, incentive ads, interstitial ads, and cover ads.

How to create an advertising slot after opening the traffic master?

 1. Log in to the background of the WeChat Mini Program – Promotion – Traffic Master – Advertisement Management – ​​click the [Create Now] button.

2. Mini program ads include banner ads, rewarded ads, interstitial ads, video ads, video pre-roll ads, grid ads, cover ads, and native template ads. Most of us only need to activate banner ads, incentive ads, interstitial ads and A cover ad will do. Click the [Create new ad slot] button.

3. Select the type of ad space, such as Banner ad, enter the name of the ad space, such as a page ad, and click the [Confirm] button. So far, we have successfully created a Banner ad and obtained the corresponding ad slot ID.

Click the [Enter Advertisement List] button to return to the advert list, and you can see that the advertisment we just created is already open. Repeat the above operations to continue creating advertising slots such as rewarded ads and interstitial ads.

4. For the setting of the cover advertisement, click to switch to "Cover Advertisement" in the advertisement slot list, click the button under the advertisement slot status to make it in the "Enabled" state, and then click "Scene Settings" under the operation.

5. In the "Display Scene" in "Quick Configuration", click the option box to display the corresponding scene options, check the scene you want to display and click the [OK] button.

Advertisement introduced by applet code

WeChat official document

Create an interstitial ad component. Please judge the version number of the basic library through  the SDKVersion of the object returned by wx.getSystemInfoSync()  before using this API. Each time this method is called to create an interstitial ad, a brand new instance will be returned (interstitial ad instances on the applet side are not allowed to be used across pages).

Code example: for reference only

mounted() {
			
			// 在页面中定义插屏广告
			let interstitialAd = null
			
			// 在页面onLoad回调事件中创建插屏广告实例
			if (wx.createInterstitialAd) {
			  interstitialAd = wx.createInterstitialAd({
			    adUnitId: 'xxxxxxxxxxxxxxx'//广告单元 id
			  })
			  interstitialAd.onLoad(() => {})
			  interstitialAd.onError((err) => {})
			  interstitialAd.onClose(() => {})
			}
			
			// 在适合的场景显示插屏广告
			if (interstitialAd) {
			  interstitialAd.show().catch((err) => {
			    console.error(err)
			  })
			}
			// 插屏广告结束
		},

Guess you like

Origin blog.csdn.net/m0_57033755/article/details/130171264