Skip to content

Commit

Permalink
修复多次调用获取公共属性方法后返回空对象的bug;修复场景值获取不到报错的bug;
Browse files Browse the repository at this point in the history
  • Loading branch information
com-xubo committed Aug 20, 2018
1 parent 067accd commit 5ef0a28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
18 changes: 10 additions & 8 deletions sensorsdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var ArrayProto = Array.prototype,
slice = ArrayProto.slice,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = '1.9.7',
LIB_VERSION = '1.9.8',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down Expand Up @@ -1121,10 +1121,11 @@ sa.init = function () {
};

sa.getPresetProperties = function () {
if (_.info && _.info.properties && _.info.properties.$lib && _.info.properties.$user_agent) {
delete _.info.properties.$lib;
delete _.info.properties.$user_agent;
return _.extend({ $url_path: _.getCurrentPath() }, _.info.properties, sa.store.getProps());
if (_.info && _.info.properties && _.info.properties.$lib && _.info.properties.$user_agent) {
var obj = _.extend({ $url_path: _.getCurrentPath() }, _.info.properties, sa.store.getProps());
delete obj.$lib;
delete obj.$user_agent;
return obj;
} else {
return {};
}
Expand Down Expand Up @@ -1300,10 +1301,11 @@ if(sa.para.autoTrack !== false){
if (!_.isEmptyObject(utms.pre2)) {
sa.registerApp(utms.pre2);
}

para.scene = para.scene || '未取到值';
prop.$scene = _.getMPScene(para.scene);
sa.registerApp({$latest_scene : prop.$scene});



if (sa.para.autoTrack && sa.para.autoTrack.appLaunch) {
sa.autoTrackCustom('appLaunch', prop, '$MPLaunch');
}
Expand All @@ -1328,8 +1330,8 @@ if(sa.para.autoTrack !== false){
sa.registerApp(utms.pre2);
}

para.scene = para.scene || '未取到值';
prop.$scene = _.getMPScene(para.scene);

sa.registerApp({$latest_scene : prop.$scene});

if (sa.para.autoTrack && sa.para.autoTrack.appShow) {
Expand Down
9 changes: 5 additions & 4 deletions sensorsdata.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sensorsdata_conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var conf = {
// 如果要通过sdk自动获取openid,需要在神策分析中配置appid和appsercret,并在这里标志appid,不需要的话,不用填。
appid: 'wx16ce2f6e06acd4d5',
// 神策分析数据接收地址
//server_url: 'https://test-syg.datasink.sensorsdata.cn/sa.gif?project=xubo&token=27f1e21b78daf376',
server_url: 'http://192.168.7.208:1234/a',
server_url: 'https://test-syg.datasink.sensorsdata.cn/sa.gif?project=xubo&token=27f1e21b78daf376',
//server_url:'https://sa.datasink.com/sa?project=production',
//请求发送超时时间
send_timeout: 1000,
// 传入的字符串最大长度限制,防止未知字符串超长
Expand Down

0 comments on commit 5ef0a28

Please sign in to comment.