HotsspAds 封装了优量汇,快手,穿山甲等多家知名联盟,实现了横幅、插屏、开屏,原生,激励视频等主流样式。使用之前请填写以下 表单 联系我们开通开发者账号,创建应用,获取应用MediaId 和 对应的广告位PosId。
使用此插件之前建议先配置 config.xml 文件,配置完毕,需通过云端编译生效,配置方法如下:
<permission name="readPhoneState"/><!--上述非必须权限,开发者视情况自行添加-->
<permission name="location" /><!--上述非必须权限,开发者视情况自行添加-->
字段描述:
MediaId:(必须配置)用于插件获取当前应用在 Hotssp 官网申请的 广告
startAd({params},callback(succ,err))
mediaId:
succ:
{
status:onInitSuccess
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
var param = {
mediaId:"7d01e45f"
};
hotlib.startAd(param,function(succ,err){
var result = succ || err;
var resJsonStr = JSON.stringify(result);
console.log("<h3>初始化SDK</h3>"+ "<br />");
console.log(resJsonStr);
});
获取Banner 类型广告
showBanner({params},callback(succ,err))
adPosId:
slideTime:
refresh:
x:
y:
w:
h:
fixedOn:
fixed:
succ:
{
status:
onAdShowed/
onAdClicked/
onAdClosed,
traceId: "175b67cdcfe34da89307a41f7ea4f873"
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadBanner(){
var param = {
adPosId: api.systemType=='ios'?"2a1c3aec":"2a1c3aev",// 代码位
slideTime:5, // (可选项) 自刷新时间 单位秒
refresh:true, // (可选项) 是否开启 自刷新 true 开启, false 关闭
//显示位置 宽高比例建议 6.4:1
rect:{
x:10,
y:80,
w:api.winWidth,
h:(api.winWidth)/6.4
},
fixedOn:"api.frameName,
// 是否跟随页面滚动
fixed:true
};
hotlib.showBanner(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
关闭Banner 类型广告
closeBanner(callback(succ,err))
var hotsspAds = api.require('hotsspAds');
function closeBanner(){
var param = {
traceId:"2a1c3aec" //代码位
};
hotlib.closeBanner(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
iOS系统,Android系统
可提供的1.0.0版本
获取开屏类型广告
loadSplashAd({params},callback(succ,err))
adPosId:
splashLogo:
splashLoadingImg:
succ:
{
status:
onAdSuccess/
onAdShowed/
onAdClicked/
onAdTick/
onAdClosed
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadSplash(){
var param = {
adPosId:api.systemType=='ios'?"d576f36d":"d576f36f",
splashLogo:"widget://image/logo.jpg", //(可选项)字符串类型,开屏广告下方的logo图片,传入后广告会自动适配屏幕大小;不传则不显示,暂只支持widget路经 禁止高度超过屏幕 1/4。
splashLoadingImg:"widget://image/loadimg.png" //(可选项)字符串类型,开屏广告的占位图片,要求高度,否则广告将无法展示;不传显示为透明背景。暂只支持widget路经
};
hotlib.loadSplashAd(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
iOS系统,Android系统
可提供的1.0.0版本
获取Native类型广告
showNative({params},callback(succ,err))
adPosId:
x:
y:
w:
h:
fixedOn:
fixed:
succ:
{
status:
onAdSuccess/
onAdShowed/
onAdClicked
traceId: "175b67cdcfe34da89307a41f7ea4f873"
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadNative(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"aa352b2f",
rect:{ // 位置 宽高 定义
x:0,
y:100,
w:api.winWidth,
h:250
},
// 绑定frame 名称
fixedOn:api.frameName,
fixed:false
};
hotlib.showNative(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
closeTraceId = JSON.parse(resJsonStr).traceId
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
关闭Native 类型广告
closeNative({params},callback(succ,err))
traceId:
ret:
{
status:
onAdClosed
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function closeNative(){
var param = {
traceId:closeTraceId
};
hotlib.closeNative(param, function(ret, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
iOS系统,Android系统
可提供的1.0.0版本
获取 插屏 类型广告
showInterAct({params},callback(succ,err))
adPosId:
succ:
{
status:
onAdShowed/
onAdClicked/
onAdClosed
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadInterAct(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"2a1c3aec"
};
hotlib.showInterAct(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
关闭InterAct 类型广告
closeInterAct(callback(succ,err))
var hotsspAds = api.require('hotsspAds');
function closeInterAct(){
hotlib.closeInterAct(function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
iOS系统,Android系统
可提供的1.0.0版本
获取 激励视频 类型广告
loadReward({params},callback(succ,err))
adPosId:
succ:
{
status:
onAdCached
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadReward(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"33a5726"
};
hotlib.loadReward(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
展示 Reward 类型广告
showReward({params}, callback(succ,err))
adPosId:
succ:
{
status:
onAdShowed/
onAdClicked/
onAdComplete/
onAdVerify/
onAdClosed
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function showReward(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"33a5726"
};
hotlib.showReward(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
备注:请再预加载广告返回onAdCached,在调用此接口,否则无响应
iOS系统,Android系统
可提供的1.0.0版本
获取 全屏视频 类型广告
loadFullScreen({params},callback(succ,err))
adPosId:
succ:
{
status:
onAdCached
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function loadFullScreen(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"deea196b"
};
hotlib.loadFullScreen(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
展示 FullScreen 类型广告
showFullScreen({params},callback(succ,err))
adPosId:
succ:
{
status:
onAdShowed/
onAdClicked/
onAdComplete/
onAdSkipped/
onAdClosed
}
err:
{
errorCode: 0 //数字类型
errorMsg: "错误信息"
}
var hotsspAds = api.require('hotsspAds');
function showFullScreen(){
var param = {
adPosId:api.systemType=='ios'?"aa352b2d":"deea196b"
};
hotlib.showFullScreen(param, function(succ, err){
var result = succ || err;
try {
var resJsonStr = JSON.stringify(result);
console.log("JS LOG resJsonStr: ", resJsonStr);
} catch(err) {
console.log("JS LOG Error: ", err);
}
});
}
备注:请再预加载广告返回onAdCached,在调用此接口,否则无响应
iOS系统,Android系统
可提供的1.0.0版本