Skip to content

Commit 96df947

Browse files
author
shengyonggen
committed
修复utm没有时候的问题
1 parent 846e9ba commit 96df947

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sensorsdata.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,13 @@ _.getUtm = function (url) {
455455
var kw = '';
456456
var params = {};
457457
url = _.decodeURIComponent(url);
458-
url = url.split('?')[1];
459-
if (url.indexOf('?') === -1) {
458+
url = url.split('?');
459+
if(url.length === 2){
460+
url = url[1];
461+
}else{
462+
return {};
463+
}
464+
460465
url = '?' + url;
461466
if (_.isArray(sa.para.source_channel) && sa.para.source_channel.length > 0) {
462467
campaign_keywords = campaign_keywords.concat(sa.para.source_channel);
@@ -473,9 +478,6 @@ _.getUtm = function (url) {
473478
}
474479
});
475480
return params;
476-
} else {
477-
return {};
478-
}
479481
};
480482

481483
_.info = {

0 commit comments

Comments
 (0)