Skip to content

Commit 846e9ba

Browse files
author
shengyonggen
committed
utm相关的没带$
1 parent 63bc66b commit 846e9ba

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

sensorsdata.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ _.getQueryParam = function (url, param) {
450450
};
451451

452452
_.getUtm = function (url) {
453+
var campagin_w = source_channel_standard.split(' ');
453454
var campaign_keywords = source_channel_standard.split(' ');
454455
var kw = '';
455456
var params = {};
@@ -464,7 +465,11 @@ _.getUtm = function (url) {
464465
_.each(campaign_keywords, function (kwkey) {
465466
kw = _.getQueryParam(url, kwkey);
466467
if (kw.length) {
467-
params[kwkey] = kw;
468+
if (_.include(campagin_w,kwkey)){
469+
params['$' + kwkey] = kw;
470+
}else{
471+
params[kwkey] = kw;
472+
}
468473
}
469474
});
470475
return params;
@@ -854,8 +859,8 @@ function pageOnload(para) {
854859
prop.$referrer = sa_referrer;
855860
prop.$url_path = router;
856861
// 暂时只解析传统网页渠道的query
857-
if (para && _.isObject(para[0]) && para[0].q) {
858-
_.extend(prop, _.getUtm(para[0].q));
862+
if (para && _.isObject(para) && para.q) {
863+
_.extend(prop, _.getUtm(para.q));
859864
}
860865

861866
if (sa.para.onshow) {

0 commit comments

Comments
 (0)