Skip to content

Commit f856cfb

Browse files
committed
更新
1 parent 491f3c0 commit f856cfb

14 files changed

+108
-37
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.13.19(2020-03-11)
2+
* 新增:新增预置点击事件 $MPClick 可通过配置确定是否采集功能;
3+
* 新增:插件版 SDK 支持 Component 构造器构造的页面的预置事件采集功能;
4+
* 优化:优化批量发送方式下请求取消时长配置;
5+
16
## 1.13.18(2020-03-05)
27
* 新增:新增预置点击事件 $MPClick 采集功能;
38
* 新增:新增 logout() 接口;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sa-sdk-miniprogram",
3-
"version": "1.13.18",
3+
"version": "1.13.19",
44
"description": "sensorsdata miniprogram sdk",
55
"main": "sensorsdata.min.js",
66
"scripts": {

product/sensorsdata.custom.es6.full.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ sa.para = {
1717
appShow: true,
1818
appHide: true,
1919
pageShow: true,
20-
pageShare: true
20+
pageShare: true,
21+
mpClick: false,
2122
},
2223
is_persistent_save: false
2324
};
@@ -113,7 +114,7 @@ var ArrayProto = Array.prototype,
113114
slice = ArrayProto.slice,
114115
toString = ObjProto.toString,
115116
hasOwnProperty = ObjProto.hasOwnProperty,
116-
LIB_VERSION = '1.13.18',
117+
LIB_VERSION = '1.13.19',
117118
LIB_NAME = 'MiniProgram';
118119

119120
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -1466,6 +1467,7 @@ sa.sendStrategy = {
14661467
dataHasSend: true,
14671468
dataHasChange: false,
14681469
syncStorage: false,
1470+
failTime: 0,
14691471
onAppHide: function() {
14701472
if (sa.para.batch_send) {
14711473
this.batchSend();
@@ -1545,12 +1547,14 @@ sa.sendStrategy = {
15451547
},
15461548
sendFail: function() {
15471549
this.dataHasSend = true;
1550+
this.failTime++;
15481551
},
15491552
batchRemove: function(len) {
15501553
sa.store.mem.clear(len);
15511554
this.dataHasSend = true;
15521555
this.dataHasChange = true;
15531556
this.batchWrite();
1557+
this.failTime = 0;
15541558
},
15551559
is_first_batch_write: true,
15561560
batchWrite: function() {
@@ -1584,7 +1588,7 @@ sa.sendStrategy = {
15841588
setTimeout(function() {
15851589
_this.batchSend();
15861590
loopSend();
1587-
}, sa.para.batch_send.send_timeout);
1591+
}, sa.para.batch_send.send_timeout * Math.pow(2, _this.failTime));
15881592
}
15891593
loopWrite();
15901594
loopSend();

product/sensorsdata.custom.full.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ sa.para = {
1717
appShow: true,
1818
appHide: true,
1919
pageShow: true,
20-
pageShare: true
20+
pageShare: true,
21+
mpClick: false,
2122
},
2223
is_persistent_save: false
2324
};
@@ -113,7 +114,7 @@ var ArrayProto = Array.prototype,
113114
slice = ArrayProto.slice,
114115
toString = ObjProto.toString,
115116
hasOwnProperty = ObjProto.hasOwnProperty,
116-
LIB_VERSION = '1.13.18',
117+
LIB_VERSION = '1.13.19',
117118
LIB_NAME = 'MiniProgram';
118119

119120
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -1466,6 +1467,7 @@ sa.sendStrategy = {
14661467
dataHasSend: true,
14671468
dataHasChange: false,
14681469
syncStorage: false,
1470+
failTime: 0,
14691471
onAppHide: function() {
14701472
if (sa.para.batch_send) {
14711473
this.batchSend();
@@ -1545,12 +1547,14 @@ sa.sendStrategy = {
15451547
},
15461548
sendFail: function() {
15471549
this.dataHasSend = true;
1550+
this.failTime++;
15481551
},
15491552
batchRemove: function(len) {
15501553
sa.store.mem.clear(len);
15511554
this.dataHasSend = true;
15521555
this.dataHasChange = true;
15531556
this.batchWrite();
1557+
this.failTime = 0;
15541558
},
15551559
is_first_batch_write: true,
15561560
batchWrite: function() {
@@ -1584,7 +1588,7 @@ sa.sendStrategy = {
15841588
setTimeout(function() {
15851589
_this.batchSend();
15861590
loopSend();
1587-
}, sa.para.batch_send.send_timeout);
1591+
}, sa.para.batch_send.send_timeout * Math.pow(2, _this.failTime));
15881592
}
15891593
loopWrite();
15901594
loopSend();

product/sensorsdata.es6.full.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ sa.para = {
1717
appShow: true,
1818
appHide: true,
1919
pageShow: true,
20-
pageShare: true
20+
pageShare: true,
21+
mpClick: false,
2122
},
2223
is_persistent_save: false
2324
};
@@ -113,7 +114,7 @@ var ArrayProto = Array.prototype,
113114
slice = ArrayProto.slice,
114115
toString = ObjProto.toString,
115116
hasOwnProperty = ObjProto.hasOwnProperty,
116-
LIB_VERSION = '1.13.18',
117+
LIB_VERSION = '1.13.19',
117118
LIB_NAME = 'MiniProgram';
118119

119120
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -1466,6 +1467,7 @@ sa.sendStrategy = {
14661467
dataHasSend: true,
14671468
dataHasChange: false,
14681469
syncStorage: false,
1470+
failTime: 0,
14691471
onAppHide: function() {
14701472
if (sa.para.batch_send) {
14711473
this.batchSend();
@@ -1545,12 +1547,14 @@ sa.sendStrategy = {
15451547
},
15461548
sendFail: function() {
15471549
this.dataHasSend = true;
1550+
this.failTime++;
15481551
},
15491552
batchRemove: function(len) {
15501553
sa.store.mem.clear(len);
15511554
this.dataHasSend = true;
15521555
this.dataHasChange = true;
15531556
this.batchWrite();
1557+
this.failTime = 0;
15541558
},
15551559
is_first_batch_write: true,
15561560
batchWrite: function() {
@@ -1584,7 +1588,7 @@ sa.sendStrategy = {
15841588
setTimeout(function() {
15851589
_this.batchSend();
15861590
loopSend();
1587-
}, sa.para.batch_send.send_timeout);
1591+
}, sa.para.batch_send.send_timeout * Math.pow(2, _this.failTime));
15881592
}
15891593
loopWrite();
15901594
loopSend();
@@ -1914,10 +1918,9 @@ App = function(option) {
19141918

19151919
var oldPage = Page;
19161920
Page = function(option) {
1921+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option);
19171922

1918-
var methods = _.getMethods(option);
1919-
1920-
for (let i = 0, len = methods.length; i < len; i++) {
1923+
for (var i = 0, len = methods.length; i < len; i++) {
19211924
click_proxy(option, methods[i]);
19221925
}
19231926

@@ -1932,10 +1935,9 @@ Page = function(option) {
19321935
var oldComponent = Component;
19331936
Component = function(option) {
19341937
try {
1935-
option.methods = option.methods || {};
1936-
var methods = _.getMethods(option.methods);
1938+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option.methods);
19371939

1938-
for (let i = 0, len = methods.length; i < len; i++) {
1940+
for (var i = 0, len = methods.length; i < len; i++) {
19391941
click_proxy(option.methods, methods[i]);
19401942
}
19411943

product/sensorsdata.full.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ sa.para = {
1717
appShow: true,
1818
appHide: true,
1919
pageShow: true,
20-
pageShare: true
20+
pageShare: true,
21+
mpClick: false,
2122
},
2223
is_persistent_save: false
2324
};
@@ -113,7 +114,7 @@ var ArrayProto = Array.prototype,
113114
slice = ArrayProto.slice,
114115
toString = ObjProto.toString,
115116
hasOwnProperty = ObjProto.hasOwnProperty,
116-
LIB_VERSION = '1.13.18',
117+
LIB_VERSION = '1.13.19',
117118
LIB_NAME = 'MiniProgram';
118119

119120
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -1466,6 +1467,7 @@ sa.sendStrategy = {
14661467
dataHasSend: true,
14671468
dataHasChange: false,
14681469
syncStorage: false,
1470+
failTime: 0,
14691471
onAppHide: function() {
14701472
if (sa.para.batch_send) {
14711473
this.batchSend();
@@ -1545,12 +1547,14 @@ sa.sendStrategy = {
15451547
},
15461548
sendFail: function() {
15471549
this.dataHasSend = true;
1550+
this.failTime++;
15481551
},
15491552
batchRemove: function(len) {
15501553
sa.store.mem.clear(len);
15511554
this.dataHasSend = true;
15521555
this.dataHasChange = true;
15531556
this.batchWrite();
1557+
this.failTime = 0;
15541558
},
15551559
is_first_batch_write: true,
15561560
batchWrite: function() {
@@ -1584,7 +1588,7 @@ sa.sendStrategy = {
15841588
setTimeout(function() {
15851589
_this.batchSend();
15861590
loopSend();
1587-
}, sa.para.batch_send.send_timeout);
1591+
}, sa.para.batch_send.send_timeout * Math.pow(2, _this.failTime));
15881592
}
15891593
loopWrite();
15901594
loopSend();
@@ -1914,10 +1918,9 @@ App = function(option) {
19141918

19151919
var oldPage = Page;
19161920
Page = function(option) {
1921+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option);
19171922

1918-
var methods = _.getMethods(option);
1919-
1920-
for (let i = 0, len = methods.length; i < len; i++) {
1923+
for (var i = 0, len = methods.length; i < len; i++) {
19211924
click_proxy(option, methods[i]);
19221925
}
19231926

@@ -1932,10 +1935,9 @@ Page = function(option) {
19321935
var oldComponent = Component;
19331936
Component = function(option) {
19341937
try {
1935-
option.methods = option.methods || {};
1936-
var methods = _.getMethods(option.methods);
1938+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option.methods);
19371939

1938-
for (let i = 0, len = methods.length; i < len; i++) {
1940+
for (var i = 0, len = methods.length; i < len; i++) {
19391941
click_proxy(option.methods, methods[i]);
19401942
}
19411943

product/sensorsdata.plugin.es6.full.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ sa.para = {
1717
appShow: true,
1818
appHide: true,
1919
pageShow: true,
20-
pageShare: true
20+
pageShare: true,
21+
mpClick: false,
2122
},
2223
is_persistent_save: false
2324
};
@@ -113,7 +114,7 @@ var ArrayProto = Array.prototype,
113114
slice = ArrayProto.slice,
114115
toString = ObjProto.toString,
115116
hasOwnProperty = ObjProto.hasOwnProperty,
116-
LIB_VERSION = '1.13.18',
117+
LIB_VERSION = '1.13.19',
117118
LIB_NAME = 'MiniProgram';
118119

119120
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -1466,6 +1467,7 @@ sa.sendStrategy = {
14661467
dataHasSend: true,
14671468
dataHasChange: false,
14681469
syncStorage: false,
1470+
failTime: 0,
14691471
onAppHide: function() {
14701472
if (sa.para.batch_send) {
14711473
this.batchSend();
@@ -1545,12 +1547,14 @@ sa.sendStrategy = {
15451547
},
15461548
sendFail: function() {
15471549
this.dataHasSend = true;
1550+
this.failTime++;
15481551
},
15491552
batchRemove: function(len) {
15501553
sa.store.mem.clear(len);
15511554
this.dataHasSend = true;
15521555
this.dataHasChange = true;
15531556
this.batchWrite();
1557+
this.failTime = 0;
15541558
},
15551559
is_first_batch_write: true,
15561560
batchWrite: function() {
@@ -1584,7 +1588,7 @@ sa.sendStrategy = {
15841588
setTimeout(function() {
15851589
_this.batchSend();
15861590
loopSend();
1587-
}, sa.para.batch_send.send_timeout);
1591+
}, sa.para.batch_send.send_timeout * Math.pow(2, _this.failTime));
15881592
}
15891593
loopWrite();
15901594
loopSend();
@@ -1911,13 +1915,36 @@ sa.App = function(option) {
19111915
};
19121916

19131917
sa.Page = function(option) {
1918+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option);
1919+
1920+
for (var i = 0, len = methods.length; i < len; i++) {
1921+
click_proxy(option, methods[i]);
1922+
}
19141923
mp_proxy(option, "onLoad", 'pageLoad');
19151924
mp_proxy(option, "onShow", 'pageShow');
19161925
if (typeof option.onShareAppMessage === 'function') {
19171926
sa.autoTrackCustom.pageShare(option);
19181927
}
19191928
Page.apply(this, arguments);
19201929
};
1930+
sa.Component = function(option) {
1931+
try {
1932+
var methods = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(option.methods);
1933+
1934+
for (var i = 0, len = methods.length; i < len; i++) {
1935+
click_proxy(option.methods, methods[i]);
1936+
}
1937+
1938+
mp_proxy(option.methods, 'onLoad', 'pageLoad');
1939+
mp_proxy(option.methods, 'onShow', 'pageShow');
1940+
if (typeof option.methods.onShareAppMessage === 'function') {
1941+
sa.autoTrackCustom.pageShare(option.methods);
1942+
}
1943+
Component.apply(this, arguments);
1944+
} catch (e) {
1945+
Component.apply(this, arguments);
1946+
}
1947+
}
19211948

19221949

19231950

0 commit comments

Comments
 (0)