From 5153f320f6c5dba1df5c1dab3ceaaf81cfe582bd Mon Sep 17 00:00:00 2001 From: Fabian Hiller Date: Tue, 27 Feb 2024 01:39:57 -0500 Subject: [PATCH] Add data-strip-search config to tracker --- src/tracker/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tracker/index.js b/src/tracker/index.js index d5278b21..fea66e09 100644 --- a/src/tracker/index.js +++ b/src/tracker/index.js @@ -14,10 +14,12 @@ const _data = 'data-'; const _false = 'false'; + const _true = 'true'; const attr = currentScript.getAttribute.bind(currentScript); const website = attr(_data + 'website-id'); const hostUrl = attr(_data + 'host-url'); const autoTrack = attr(_data + 'auto-track') !== _false; + const stripSearch = attr(_data + 'strip-search') === _true; const dnt = attr(_data + 'do-not-track'); const domain = attr(_data + 'domains') || ''; const domains = domain.split(',').map(n => n.trim()); @@ -218,7 +220,7 @@ }; } - let currentUrl = `${pathname}${search}`; + let currentUrl = `${pathname}${stripSearch ? '' : search}`; let currentRef = document.referrer; let title = document.title; let cache;