更新记录
1.0.3(2026-07-21)
- 重构插件,升级iOS和Android的sdk
- 支持友盟移动统计、性能监控apm
1.0.2(2023-08-21)
- 优化语法
1.0.1(2023-08-11)
优化注解
查看更多
平台兼容性
uni-app(3.8.0)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
- |
- |
√ |
√ |
5.0 |
√ |
- |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
小红书小程序 |
快应用-华为 |
快应用-联盟 |
| - |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(3.8.0)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| - |
- |
5.0 |
√ |
- |
- |
其他
友盟移动统计、性能监控
集成步骤
- 拷贝demo示例项目里的AndroidManifest.xml文件到项目根目录
- 咨询或定制请点击上面"进入交流群"按钮私聊作者
接口
import {
UTSUmeng,
UTSMobclickAgent
} from "@/uni_modules/wrs-uts-umeng"
switch (uni.getSystemInfoSync().platform) {
case "harmonyos": {
UTSUmeng.setLogEnabled(true)
let appKey = "6a5331ffcbfa695951753465"
let channel = "store"
UTSUmeng.preInit({
appKey: appKey,
channel: channel,
enableJSCatch: false
})
UTSUmeng.umengInit({}, (resp)=>{
})
}
break;
case 'android': {
let appKey = "6a4def426f259537c7c5e128"
let channel = "store"
let deviceType = 1 // 1: phone 2:box
let pushSecret =
"4c20916757f54a8b9272301bfb666ccc" //Push推送业务的secret, Umeng Message Secret,如果不需要友盟推送功能的话,这个字段填空字符串
UTSUmeng.preInit({
appKey: appKey,
channel: channel
})
UTSUmeng.umengInit({
appKey: appKey,
channel: channel,
deviceType: deviceType,
pushSecret: pushSecret,
asynch: true // 是否异步执行
}, (resp) => {
console.log("umengInit resp:" + JSON.stringify(resp))
})
}
break;
case 'ios': {
let appKey = "6a4ef58a6f259537c7c6462a";
let channel = "appStore";
UTSUmeng.umengInit({
appKey: appKey,
channel: channel
}, (resp) => {
console.log("umengInit resp:" + JSON.stringify(resp))
});
}
break;
default:
break;
}
友盟移动统计
let id = "zhuangsan_xx123222222222"; // 用户账号ID,长度小于64字节
let provider =
"qq"; // 账号来源。如果用户通过第三方账号登陆,可以调用此接口进行统计。支持自定义,不能以下划线”_”开头,使用大写字母和数字标识,长度小于32 字节; 如果是上市公司,建议使用股票代码。
UTSMobclickAgent.onProfileSignIn({
userId: id,
provider: provider // provider参数可以不传
});
UTSMobclickAgent.onProfileSignOff();
let eventID = "onEventObject_first";
let params = {};
params.name = "Jack_first";
params.age = 11;
UTSMobclickAgent.onEventObject(eventID, params);
let eventID = "onEvent_first";
UTSMobclickAgent.onEvent(eventID);
let eventID = "onEvent_first";
let label = "foods"
UTSMobclickAgent.onEventLabel(eventID, label);
let eventID = "onEventAttributes_first";
let attributes = {
"name": "kk",
"age": 20
}
UTSMobclickAgent.onEventAttributes(eventID, attributes);
let eventID = "onEventAttributesCounter_first";
let attributes = {
"name": "kk",
"age": 20
}
let counter = 200
UTSMobclickAgent.onEventAttributesCounter(eventID, attributes, counter);
性能监控
- 测试闪退
闪退后重启app,这时可以在友盟后台看到闪退日志
UTSUMCrash.testCrash()