敬告:此 demo 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议,威尼斯人888-5845vip威尼斯电子游戏。
♦ js-sdk 引用方式:
♦ 普通网页 script 方式加载:下载最新版 ,请在页面上调用 jsbridge 接口之前引用 jsbridge-mini.js 库;
♦ js module 方式引用:npm install ym-jsbridge
♦
♦ js api 的详细说明请参见 的同名接口
事件监听
• 如需接口调用事件,请设置此监听器;
jsbridge.flyer.setlistener(function(event, data) {
showresult({
event: event,
data : data
});
});
//请拉到页面底部查看回调数据信息
$('html,body').animate({ scrolltop: $('#view').offset().top }, 500);
/**
回调参数说明:
event - 事件代码,字符串类型
data - 事件数据,json 对象
**/
//移除监听器,不会再收到回调通知 //在需要时可重新调用 setlistener jsbridge.flyer.removelistener();
业务接口
//示例购买成功
jsbridge.flyer.logevent({
//必须,事件名称
//建议尽量使用
name : "af_purchase",
//必须,事件参数
//建议尽量使用
value: {
af_revenue : 1234.56,
af_content_type: "shirt",
af_content_id : "1234567",
af_currency : "usd"
}
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.setadditionaldata({
custom_param_1: "value_of_param_1"
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.setmintimebetweensessions({
//必须,会话之间的最短时间,最少5秒
minseconds: 30
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.logsession(function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.setresolvedeeplinkurls({
//必须,域名列表
urls: [
"clickdomain.com",
"myclickdomain.com",
"anotherclickdomain.com"
]
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.sendpushnotificationdata(function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.getappsflyeruid(function(succ, data) {
alert(json.stringify(data));
});
/*
data 参数返回
{
appsflyerid: //appsflyer id
}
*/
jsbridge.flyer.setcustomeruserid({
userid: "user123"
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.setcollect({
//imei
imei: false,
//oaid
oaid: false,
//android id
androidid: false
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.setcollectdata({
//imei
imei: "xxxxxx",
//oaid
oaid: "yyyyyy",
//android id
androidid: "zzzzzzz"
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.stop(function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.start(function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
jsbridge.flyer.anonymizeuser({
//是否匿名
anonymize: false
}, function(succ, data) {
if (!succ) {
alert("失败\n" json.stringify(data));
}
});
监听回调数据: