Skip to content

Commit 5ef0a28

Browse files
committed
修复多次调用获取公共属性方法后返回空对象的bug;修复场景值获取不到报错的bug;
1 parent 067accd commit 5ef0a28

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

sensorsdata.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var ArrayProto = Array.prototype,
2626
slice = ArrayProto.slice,
2727
toString = ObjProto.toString,
2828
hasOwnProperty = ObjProto.hasOwnProperty,
29-
LIB_VERSION = '1.9.7',
29+
LIB_VERSION = '1.9.8',
3030
LIB_NAME = 'MiniProgram';
3131

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

11231123
sa.getPresetProperties = function () {
1124-
if (_.info && _.info.properties && _.info.properties.$lib && _.info.properties.$user_agent) {
1125-
delete _.info.properties.$lib;
1126-
delete _.info.properties.$user_agent;
1127-
return _.extend({ $url_path: _.getCurrentPath() }, _.info.properties, sa.store.getProps());
1124+
if (_.info && _.info.properties && _.info.properties.$lib && _.info.properties.$user_agent) {
1125+
var obj = _.extend({ $url_path: _.getCurrentPath() }, _.info.properties, sa.store.getProps());
1126+
delete obj.$lib;
1127+
delete obj.$user_agent;
1128+
return obj;
11281129
} else {
11291130
return {};
11301131
}
@@ -1300,10 +1301,11 @@ if(sa.para.autoTrack !== false){
13001301
if (!_.isEmptyObject(utms.pre2)) {
13011302
sa.registerApp(utms.pre2);
13021303
}
1304+
1305+
para.scene = para.scene || '未取到值';
13031306
prop.$scene = _.getMPScene(para.scene);
13041307
sa.registerApp({$latest_scene : prop.$scene});
1305-
1306-
1308+
13071309
if (sa.para.autoTrack && sa.para.autoTrack.appLaunch) {
13081310
sa.autoTrackCustom('appLaunch', prop, '$MPLaunch');
13091311
}
@@ -1328,8 +1330,8 @@ if(sa.para.autoTrack !== false){
13281330
sa.registerApp(utms.pre2);
13291331
}
13301332

1333+
para.scene = para.scene || '未取到值';
13311334
prop.$scene = _.getMPScene(para.scene);
1332-
13331335
sa.registerApp({$latest_scene : prop.$scene});
13341336

13351337
if (sa.para.autoTrack && sa.para.autoTrack.appShow) {

sensorsdata.min.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata_conf.js

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

0 commit comments

Comments
 (0)