Skip to content

Commit e717409

Browse files
committed
Save local changes [no ci]
1 parent dc1a3ef commit e717409

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

src/auto-events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
/^https?:\/\//i.test(link.href) &&
156156
new RegExp(
157157
"\\.(" + (optionsLink.downloadsExtensions || []).join("|") + ")$",
158-
"i",
158+
"i"
159159
).test(link.pathname)
160160
) {
161161
collect = "download";

src/default.js

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -345,24 +345,13 @@
345345
Date.now();
346346
};
347347

348-
var cleanSubdomain = function (url) {
349-
if (!url) return;
350-
return url.replace(
351-
/^(https?:\/\/)?((m|l|w{2,3}([0-9]+)?)\.)?([^?#]+)(.*)$/,
352-
"$5"
353-
);
354-
};
355-
356348
// Customers can overwrite their hostname, here we check for that
357-
var overwrittenHostname = cleanSubdomain(
358-
overwriteOptions.hostname || attr(scriptElement, "hostname")
359-
);
360-
361-
var definedHostname = cleanSubdomain(
362-
overwrittenHostname || locationHostname
363-
);
349+
var overwrittenHostname =
350+
overwriteOptions.hostname || attr(scriptElement, "hostname");
351+
var definedHostname = overwrittenHostname || locationHostname;
364352

365353
var basePayload = {
354+
pullrequest: "54",
366355
version: version,
367356
hostname: definedHostname,
368357
};
@@ -498,13 +487,12 @@
498487
//
499488

500489
/** if botdetection **/
501-
var phantom = window.phantom;
502490
var bot =
503491
nav.webdriver ||
504492
window.__nightmare ||
505493
window.callPhantom ||
506494
window._phantom ||
507-
(phantom && !phantom.solana) ||
495+
window.phantom ||
508496
window.__polypane ||
509497
window._bot ||
510498
isBotAgent ||
@@ -596,9 +584,16 @@
596584
var page = {};
597585
var lastSendPath;
598586

587+
// Customers can overwrite their referrer, here we check for that
588+
var overwrittenReferrer =
589+
overwriteOptions.referrer || attr(scriptElement, "referrer");
590+
599591
var getReferrer = function () {
600-
return cleanSubdomain(
601-
(doc.referrer || "").replace(locationHostname, definedHostname)
592+
return (
593+
(overwrittenReferrer || doc.referrer || "")
594+
.replace(locationHostname, definedHostname)
595+
.replace(/^https?:\/\/((m|l|w{2,3}([0-9]+)?)\.)?([^?#]+)(.*)$/, "$4")
596+
.replace(/^([^/]+)$/, "$1") || undefinedVar
602597
);
603598
};
604599

@@ -847,10 +842,7 @@
847842

848843
/** if uniques **/
849844
// We set unique variable based on pushstate or back navigation, if no match we check the referrer
850-
page.unique =
851-
/__cf_/.test(getReferrer()) || isPushState || userNavigated
852-
? falseVar
853-
: !sameSite;
845+
page.unique = isPushState || userNavigated ? falseVar : !sameSite;
854846
/** endif **/
855847

856848
/** if metadata **/
@@ -961,17 +953,17 @@
961953

962954
/** if (or spa hash) **/
963955
if (autoCollect) pageview();
964-
965-
/** if metadata **/
966-
window.sa_pageview = function (path, metadata) {
967-
pageview(0, path, metadata);
968-
};
969-
/** else **/
970-
window.sa_pageview = function (path) {
971-
pageview(0, path);
972-
};
973-
/** endif **/
974-
956+
else {
957+
/** if metadata **/
958+
window.sa_pageview = function (path, metadata) {
959+
pageview(0, path, metadata);
960+
};
961+
/** else **/
962+
window.sa_pageview = function (path) {
963+
pageview(0, path);
964+
};
965+
/** endif **/
966+
}
975967
/** else **/
976968
pageview();
977969
/** endif **/

0 commit comments

Comments
 (0)