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

Disable cookies option #235

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Reduce number of if statements
  • Loading branch information
Jeremy Garey committed Jul 26, 2023
commit 3016de8b6c399459f1d7cfec4b761094a3af982e
14 changes: 3 additions & 11 deletions dist/keen-tracking.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/keen-tracking.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/keen-tracking.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/keen-tracking.min.js.map

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions lib/browser-auto-tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ export function initAutoTrackingCore(lib) {
}
}

let cookie;
if (!options.disableCookies) {
cookie = new utils.cookie('keen');
}
const cookie = new utils.cookie('keen');

const domainName = helpers.getDomainName(window.location.hostname);
const cookieDomain = domainName && options.shareUuidAcrossDomains ? {
Expand All @@ -81,9 +78,7 @@ export function initAutoTrackingCore(lib) {

let uuid;
if (options.collectUuid) {
if (!options.disableCookies) {
uuid = cookie.get('uuid');
}
uuid = cookie.get('uuid');
if (!uuid) {
uuid = helpers.getUniqueId();
if (!options.disableCookies) { // if cookies disabled, uuid will not persist across page reloads or subsequent visits
Expand All @@ -92,10 +87,7 @@ export function initAutoTrackingCore(lib) {
}
}

let initialReferrer;
if (!options.disableCookies) {
initialReferrer = cookie.get('initialReferrer');
}
let initialReferrer = cookie.get('initialReferrer');
if (!initialReferrer) {
initialReferrer = document && document.referrer || undefined;
if (!options.disableCookies) {
Expand Down