Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add referrer overwriting #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
Date.now();
};


// Customers can overwrite their hostname, here we check for that
var overwrittenHostname =
overwriteOptions.hostname || attr(scriptElement, "hostname");
Expand Down Expand Up @@ -583,9 +584,13 @@
var page = {};
var lastSendPath;

// Customers can overwrite their referrer, here we check for that
var overwrittenReferrer =
overwriteOptions.referrer || attr(scriptElement, "referrer");

var getReferrer = function () {
return (
(doc.referrer || "")
(overwrittenReferrer || doc.referrer || "")
.replace(locationHostname, definedHostname)
.replace(/^https?:\/\/((m|l|w{2,3}([0-9]+)?)\.)?([^?#]+)(.*)$/, "$4")
.replace(/^([^/]+)$/, "$1") || undefinedVar
Expand Down