Skip to content

Commit 12b29ae

Browse files
committed
增加了首次
1 parent bd8a6a7 commit 12b29ae

File tree

3 files changed

+107
-6
lines changed

3 files changed

+107
-6
lines changed

sensorsdata.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var ArrayProto = Array.prototype,
2323
slice = ArrayProto.slice,
2424
toString = ObjProto.toString,
2525
hasOwnProperty = ObjProto.hasOwnProperty,
26-
LIB_VERSION = '1.7',
26+
LIB_VERSION = '1.8',
2727
LIB_NAME = 'MiniProgram';
2828

2929
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -666,8 +666,12 @@ _.getUtm = function(url,prefix1,prefix2){
666666
}
667667

668668
_.getMPScene = function (key) {
669-
key = String(key);
670-
return mp_scene[key] || key;
669+
if(typeof key === "number" || (typeof key === "string" && key !== "")){
670+
key = String(key);
671+
return mp_scene[key] || key;
672+
}else{
673+
return "未取到值";
674+
}
671675
};
672676

673677
_.setUtm = function(para,prop){
@@ -1199,15 +1203,20 @@ function appLaunch(para) {
11991203
}
12001204
var utms = _.setUtm(para,prop);
12011205
if (is_first_launch) {
1206+
prop.$is_first_time = true;
12021207
if (!_.isEmptyObject(utms.pre1)){
12031208
sa.setOnceProfile(utms.pre1);
12041209
}
1210+
}else{
1211+
prop.$is_first_time = false;
12051212
}
1213+
12061214
if (!_.isEmptyObject(utms.pre2)) {
12071215
sa.registerApp(utms.pre2);
12081216
}
12091217
prop.$scene = _.getMPScene(para.scene);
1210-
// console.log('app_launch', JSON.stringify(arguments));
1218+
//sa.registerApp({$latest_scene : prop.$scene});
1219+
12111220
if (sa.para.autoTrack && sa.para.autoTrack.appLaunch) {
12121221
sa.autoTrackCustom('appLaunch', prop, '$MPLaunch');
12131222
}
@@ -1231,6 +1240,8 @@ function appShow(para) {
12311240
}
12321241

12331242
prop.$scene = _.getMPScene(para.scene);
1243+
//sa.registerApp({$latest_scene : prop.$scene});
1244+
12341245
if (sa.para.autoTrack && sa.para.autoTrack.appShow) {
12351246
sa.autoTrackCustom('appShow',prop,'$MPShow');
12361247
}

0 commit comments

Comments
 (0)