Skip to content

Commit 22d0ceb

Browse files
author
shengyonggen
committed
恢复utm值
1 parent 3a98ce7 commit 22d0ceb

File tree

6 files changed

+57
-12
lines changed

6 files changed

+57
-12
lines changed

sensorsdata.amd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sdk.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,14 +2346,29 @@ saEvent.send = function(p, callback) {
23462346
},
23472347
autoTrackSinglePage:function(para,callback){
23482348
var url = _.info.pageProp.url;
2349+
2350+
function getUtm(){
2351+
var utms = _.info.campaignParams();
2352+
var $utms = {};
2353+
for (var i in utms) {
2354+
if ((' ' + source_channel_standard + ' ').indexOf(' ' + i + ' ') !== -1) {
2355+
$utms['$' + i] = utms[i];
2356+
} else {
2357+
$utms[i] = utms[i];
2358+
}
2359+
}
2360+
return $utms;
2361+
}
2362+
2363+
23492364
function closure(){
23502365
sd.track('$pageview', _.extend({
23512366
$referrer: url,
23522367
$referrer_host: _.url('hostname',url) || '',
23532368
$url: location.href,
23542369
$url_path: location.pathname,
23552370
$title: document.title
2356-
}, para),callback
2371+
}, para, getUtm()),callback
23572372
);
23582373
url = location.href;
23592374
}
@@ -2405,7 +2420,7 @@ saEvent.send = function(p, callback) {
24052420
$url: location.href,
24062421
$url_path: location.pathname,
24072422
$title: document.title
2408-
}, para),callback
2423+
}, $utms, para),callback
24092424
);
24102425
current_page_url = location.href;
24112426
});
@@ -2417,7 +2432,7 @@ saEvent.send = function(p, callback) {
24172432
$url: location.href,
24182433
$url_path: location.pathname,
24192434
$title: document.title
2420-
},para),callback
2435+
}, $utms, para),callback
24212436
);
24222437

24232438
}

src/sensorsdata.full.amd.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,14 +2478,29 @@ saEvent.send = function(p, callback) {
24782478
},
24792479
autoTrackSinglePage:function(para,callback){
24802480
var url = _.info.pageProp.url;
2481+
2482+
function getUtm(){
2483+
var utms = _.info.campaignParams();
2484+
var $utms = {};
2485+
for (var i in utms) {
2486+
if ((' ' + source_channel_standard + ' ').indexOf(' ' + i + ' ') !== -1) {
2487+
$utms['$' + i] = utms[i];
2488+
} else {
2489+
$utms[i] = utms[i];
2490+
}
2491+
}
2492+
return $utms;
2493+
}
2494+
2495+
24812496
function closure(){
24822497
sd.track('$pageview', _.extend({
24832498
$referrer: url,
24842499
$referrer_host: _.url('hostname',url) || '',
24852500
$url: location.href,
24862501
$url_path: location.pathname,
24872502
$title: document.title
2488-
}, para),callback
2503+
}, para, getUtm()),callback
24892504
);
24902505
url = location.href;
24912506
}
@@ -2537,7 +2552,7 @@ saEvent.send = function(p, callback) {
25372552
$url: location.href,
25382553
$url_path: location.pathname,
25392554
$title: document.title
2540-
}, para),callback
2555+
}, $utms, para),callback
25412556
);
25422557
current_page_url = location.href;
25432558
});
@@ -2549,7 +2564,7 @@ saEvent.send = function(p, callback) {
25492564
$url: location.href,
25502565
$url_path: location.pathname,
25512566
$title: document.title
2552-
},para),callback
2567+
}, $utms, para),callback
25532568
);
25542569

25552570
}

src/sensorsdata.full.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,14 +2475,29 @@ saEvent.send = function(p, callback) {
24752475
},
24762476
autoTrackSinglePage:function(para,callback){
24772477
var url = _.info.pageProp.url;
2478+
2479+
function getUtm(){
2480+
var utms = _.info.campaignParams();
2481+
var $utms = {};
2482+
for (var i in utms) {
2483+
if ((' ' + source_channel_standard + ' ').indexOf(' ' + i + ' ') !== -1) {
2484+
$utms['$' + i] = utms[i];
2485+
} else {
2486+
$utms[i] = utms[i];
2487+
}
2488+
}
2489+
return $utms;
2490+
}
2491+
2492+
24782493
function closure(){
24792494
sd.track('$pageview', _.extend({
24802495
$referrer: url,
24812496
$referrer_host: _.url('hostname',url) || '',
24822497
$url: location.href,
24832498
$url_path: location.pathname,
24842499
$title: document.title
2485-
}, para),callback
2500+
}, para, getUtm()),callback
24862501
);
24872502
url = location.href;
24882503
}
@@ -2534,7 +2549,7 @@ saEvent.send = function(p, callback) {
25342549
$url: location.href,
25352550
$url_path: location.pathname,
25362551
$title: document.title
2537-
}, para),callback
2552+
}, $utms, para),callback
25382553
);
25392554
current_page_url = location.href;
25402555
});
@@ -2546,7 +2561,7 @@ saEvent.send = function(p, callback) {
25462561
$url: location.href,
25472562
$url_path: location.pathname,
25482563
$title: document.title
2549-
},para),callback
2564+
}, $utms, para),callback
25502565
);
25512566

25522567
}

vtrack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)