敬告:此 demo 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议。
♦ js-sdk 引用方式:
♦ 普通网页 script 方式加载:下载最新版 ,请在页面上调用 jsbridge 接口之前引用 jsbridge-mini.js 库;
♦ js module 方式引用:npm install ym-jsbridge
jsbridge.gtm.logevent({
//事件名称
name: "share_image",
//事件参数,任意键值对
values: {
image_name: "hello",
full_text : "世界"
}
}, function(success, res) {
alert(success ? "成功" : json.stringify(res));
});
jsbridge.gtm.setuserproperty({
//属性名
name: "user_level",
//属性值
value: "vip"
}, function(success, res) {
alert(success ? "成功" : json.stringify(res));
});
jsbridge.gtm.setuserid({
userid: "user123"
}, function(success, res) {
alert(success ? "成功" : json.stringify(res));
});
jsbridge.gtm.getfirebaseinfo(function(success, res) {
//成功时 res 返回
//res.appinstanceid
//res.sessionid
alert(`${success ? '成功' : '失败'}\n${json.stringify(res)}`);
});