Skip to content

Commit

Permalink
增加了首次
Browse files Browse the repository at this point in the history
  • Loading branch information
com-xubo committed Jul 12, 2018
1 parent bd8a6a7 commit 12b29ae
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 6 deletions.
19 changes: 15 additions & 4 deletions sensorsdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var ArrayProto = Array.prototype,
slice = ArrayProto.slice,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = '1.7',
LIB_VERSION = '1.8',
LIB_NAME = 'MiniProgram';

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

_.getMPScene = function (key) {
key = String(key);
return mp_scene[key] || key;
if(typeof key === "number" || (typeof key === "string" && key !== "")){
key = String(key);
return mp_scene[key] || key;
}else{
return "未取到值";
}
};

_.setUtm = function(para,prop){
Expand Down Expand Up @@ -1199,15 +1203,20 @@ function appLaunch(para) {
}
var utms = _.setUtm(para,prop);
if (is_first_launch) {
prop.$is_first_time = true;
if (!_.isEmptyObject(utms.pre1)){
sa.setOnceProfile(utms.pre1);
}
}else{
prop.$is_first_time = false;
}

if (!_.isEmptyObject(utms.pre2)) {
sa.registerApp(utms.pre2);
}
prop.$scene = _.getMPScene(para.scene);
// console.log('app_launch', JSON.stringify(arguments));
//sa.registerApp({$latest_scene : prop.$scene});

if (sa.para.autoTrack && sa.para.autoTrack.appLaunch) {
sa.autoTrackCustom('appLaunch', prop, '$MPLaunch');
}
Expand All @@ -1231,6 +1240,8 @@ function appShow(para) {
}

prop.$scene = _.getMPScene(para.scene);
//sa.registerApp({$latest_scene : prop.$scene});

if (sa.para.autoTrack && sa.para.autoTrack.appShow) {
sa.autoTrackCustom('appShow',prop,'$MPShow');
}
Expand Down
Loading

0 comments on commit 12b29ae

Please sign in to comment.