forked from umeng/mp-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuma.js
More file actions
63 lines (61 loc) · 1.67 KB
/
uma.js
File metadata and controls
63 lines (61 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// #ifdef MP-WEIXIN
import uma from 'umtrack-wx';
uma.init({
appKey: 'xxxxxx',
useOpenid: false,
autoGetOpenid: false,
debug: true
});
// #endif
// #ifdef MP-ALIPAY
import uma from 'umtrack-alipay';
uma.init({
appKey: 'xxxxx',
debug: true
});
// #endif
// #ifdef MP-TOUTIAO
import uma from './libs/umtrack-tt/tt/lib/uma.min.js';
uma.init({
appKey:'yourappkey', //由友盟分配的APP_KEY
autoGetOpenid: false, // 是否需要通过友盟后台获取openid或匿名openid,如若需要,请到友盟后台设置appId及secret,若设置了false,tt比较特殊,需要手动调用setAnonymousid设置这个参数
debug: true, //是否打开调试模式
uploadUserInfo: true // 自动上传用户信息,设为false取消上传,默认为false
})
// #endif
// #ifdef MP-BAIDU
import uma from './libs/umtrack-swan/swan/lib/uma.min.js'
uma.init({
appKey: 'YOUR_UMENG_APPKEY', //由友盟分配的APP_KEY
// 是否需要通过友盟后台获取openid或匿名openid,如若需要,请到友盟后台设置appId及secret
autoGetOpenid: false,
debug: true, //是否打开调试模式
uploadUserInfo: false // 自动上传用户信息,设为false取消上传,默认为false
})
// #endif
// #ifdef MP-QQ
import uma from './libs/umtrack-qq/qq/lib/uma.min.js';
uma.init({
appKey: 'xxxxxx',
useOpenid: false,
autoGetOpenid: false,
debug: true
});
// #endif
// #ifdef H5
const uma = {
init:()=>{},
_inited:false,
trackEvent:()=>{},
setOpenid:()=>{},
setUserid:()=>{},
setUnionid:()=>{},
pause:()=>{},
resume:()=>{}
}
// #endif
// 适配vue插件如此可通过Vue.use(uma)来安装
uma.install = function (Vue) {
Vue.prototype.$uma = uma;
}
export default uma;