|
@@ -3,6 +3,7 @@ import sensors from '@/lib/Sensorsdata-UniPlugin-JS';
|
|
|
import Vue from 'vue';
|
|
|
import uni from '@/utils/uniHooks';
|
|
|
import store from '@/store/index'
|
|
|
+import { getPlatform } from '@/utils/index';
|
|
|
|
|
|
/**
|
|
|
* 上传埋点数据至神策(第三方埋点平台)
|
|
@@ -18,9 +19,28 @@ const normalTrack = (eventName, properites, trackingEnable = true) => {
|
|
|
|
|
|
|
|
|
|
|
|
-// 设置全埋点事件及埋点公共字段
|
|
|
+// 设置全埋点事件及埋点公共字段(仅在小程序中实现,H5另定)
|
|
|
const trackingInit = () => {
|
|
|
-
|
|
|
+ const platform = getPlatform();
|
|
|
+ if ( platform !== 'miniprogram') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // console.log(23, window.toWXSendMsg);
|
|
|
+ // console.log(23, store.state.appId);
|
|
|
+ // 微信小程序
|
|
|
+ if (getPlatform() === 'miniprogram') {
|
|
|
+ // window.toWXSendMsg({
|
|
|
+ // type: 'scanQRCode',
|
|
|
+ // });
|
|
|
+ // window.subscribe('scanQRCodeOver', (options) => {
|
|
|
+ // console.log('微信扫码结束之后的返回参数', options);
|
|
|
+ // runScanFn(options);
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ if (store.state.appId === '') {
|
|
|
+ // window.toWXSendMsg =
|
|
|
+ }
|
|
|
+ return
|
|
|
const project = 'kerryplus';
|
|
|
const defaultLbs = uni.getStorageSync("DEFAULT_LBS");
|
|
|
const lbsId = defaultLbs.lbs?.id;
|
|
@@ -81,6 +101,15 @@ const trackingInit = () => {
|
|
|
saglobal_open_id: openId,
|
|
|
saglobal_profile_id: profileId
|
|
|
});
|
|
|
+ sensors.registerApp({
|
|
|
+ saglobal_product_name: project,
|
|
|
+ //小程序的brand
|
|
|
+ saglobal_digital_brand_id: uni.getStorageSync('groupId') || '',
|
|
|
+ //小程序的LBS ID
|
|
|
+ saglobal_lbs_id: uni.getStorageSync('mallid') || '',
|
|
|
+ // 小程序的LBS Name
|
|
|
+ saglobal_lbs_name: _this.globalData.marketName || '',
|
|
|
+ })
|
|
|
//埋点初始化
|
|
|
sensors.init();
|
|
|
}
|
|
@@ -260,5 +289,5 @@ export default () => {
|
|
|
// console.log('ENVIRONMENTS', sensors);
|
|
|
// 埋点参数设置及公共字段初始化
|
|
|
trackingInit();
|
|
|
- Vue.prototype.trackFactory = TrackFactory;
|
|
|
+ Vue.prototype.$trackFactory = TrackFactory;
|
|
|
}
|