Skip to content

广告标签管理,快速渲染您的广告位

Notifications You must be signed in to change notification settings

Game-Bridge/ads-tag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 

Repository files navigation

ads Tag Label Management

Input Method

First, the adsTag script needs to be input in the head area

<script>
	window.adsTag = window.adsTag || { cmd: [] };
</script>
<script
	id="ads-tag-sdk"
	data-site-id="site_11"
	src="https://sdk.beesads.com/v1/ads-tag.js">
</script>

Parameter Description

Parameters Type Description Prerequisite or not
id string The tag of the current script, fixed value: ads-tag-sdk Yes
data-site-id string The unique domain name identification, provided by the administrator Yes
data-utm-source string channel ID, its weight factor is higher than utm-source of url parameter. No
data-test string Enable Test Mode or Not: Test Mode will be opened when value=on. Caution! Do not use it in Production Environment. No
src string sdk address, fixed value: https://sdk.beesads.com/v1/ads-tag.js Yes

Use

Direct call

window.adsTag.renderAds(document.querySelector('#test-one'), 300, 250, zoneId);

Call with cmd

If you can’t confirm if adsTag is loaded while using, then it is recommended to call with cmd.

window.adsTag.cmd.push(function (){
	window.adsTag.renderAds(document.querySelector('#test-one'), 300, 250, zoneId);
});

Initialization

window.adsTag.init({
	// Whether to enable fixed width, false as the default, it is recommended to use the default value to achieve higher benefits
	fixedWidth: true
});

Render ads

I. Display Ads zoneType: Display

  • 1.Designate a dom node as the ad container for renderAds by binding an id or other attribute identifier.
<div id="test-one"></div>
  • 2.Usewindow.adsTag.renderAds(dom, width, height, zoneId)to render the ads
Parameter Description
Parameters Type Description Mandatory or not Default Value
dom HtmlElement Need the container in which the ads are rendered, for a good experience the width and height of the container should be bigger than or equal to the values set by the parameters of width and height. Yes --
width number Specify the width of the ads Yes --
height number Specify the height of the ads Yes --
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
Example
window.adsTag.renderAds(document.querySelector('#test-one'), 300, 250, zoneId);

II. WebInterstitial Ads zoneType: WebInterstitial

Inserting ads don’t need to create a container, the ads are rendered by calling window.adsTag.renderInterstitial(zoneId, querySelector)method

Parameter Description
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
querySelector string Specifies that the a tags matching this selector should use interstitial ads, when the parameter is empty, all a tags will take effect. Selectors are recommended to use className or attribute, and care is taken to ensure that there are no events that block href jumps No --
Example
window.adsTag.renderInterstitial(zoneId);
Caution
  • When this method is called, it only takes effect on the a tag jump in the page
  • Can only be called once in a single page, multiple calls are invalid

III. Anchor Ads zoneType: Anchor

Anchor ads don't need to create a container, ads are rendered by calling window.adsTag.renderAnchor(zoneId, type) method

Parameter Description
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
type string Position of the anchored ad, optional values: 'top', 'bottom' No 'bottom'
Example
window.adsTag.renderAnchor(zoneId, 'bottom');
Caution
  • Can only be called once in a single page, multiple calls are invalid

IV. Reward Ads zoneType: Reward

Incentivized ads don't need to create a container, ads are rendered by calling window.adsTag.renderReward(zoneId, doneFn) method

Parameter Description
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
doneFn function Incentive ad completion execution function, the parameter rewardStatus returns the display status of the incentive ad. No (rewardStatus) => {}
Example
window.adsTag.renderReward(zoneId, (rewardedStatus) => {
    if (rewardedStatus) {
	// Execute the incentive ad display after completion of the operation
	} else {
        // Perform Incentive Ad Display Not Completed Action
	}
});
Caution
  • Incentivized ads may display video ads, it is recommended to call this method after the user has generated a page interaction

V. Interstitial Ads zoneType: Interstitial

Inserted screen ads don't need to create a container, ads are rendered by calling window.adsTag.adBreak({ zoneId, type, adBreakDone }) method

Parameter Description
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
type string Specify the type of ad, passable parameters: preroll, midroll, reward Yes --
adBreakDone function The function is executed after the advertisement fails or finishes playing, and the parameter viewed returns the display status of the advertisement. No (viewed) => {}
Example
window.adsTag.adBreak({ zoneId: 'xxx', type: 'midroll', adBreakDone: (viewed) => {
    if (viewed) {
        // Ads Display Successfully
	} else {
        // Failure to display ads, or aborted by the user
	}
}});

Ⅵ. Sidewall Ads zoneType: Sidewall

Sidewall Ads do not need create container. Render it through the instruction from “window.adsTag.renderSidewall(zoneId)”.

Parameter Description:
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
Example:
window.adsTag.renderSidewall(zoneId);

Ⅶ. Fixed Ads zoneType: Fixed

Fixed Ads do not need create container. Render it through the instruction from “window.adsTag.renderFixed(zoneId, width, heigth)”.

Parameter Description:
Parameters Type Description Mandatory or not Default Value
zoneId string Specify the ad unit group, use this parameter to differentiate the ad group revenue Yes --
width number Specify Ads Width. Adjust it according to the actual layout of Web. No 300
height number Specify Ads Height. Adjust it according to the actual layout of Web. No 250
Example:
window.adsTag.renderFixed(zoneId);

Example of Ads Effect

PC Banner

pc banner

PC Interstitial

pc interstitial

Mobile

mobile

About

广告标签管理,快速渲染您的广告位

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published