Skip to content

Commit 6bdac20

Browse files
committed
feat: respect doNotTrack preference for Matomo
1 parent 2a16bd1 commit 6bdac20

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/utils/matomo.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export const trackCustomEvent = ({
1818
eventValue,
1919
}: MatomoEventOptions): void => {
2020
if (!IS_PROD) return
21+
22+
// Respect Do Not Track header
23+
if (navigator.doNotTrack === "1") return
24+
2125
const optedOutValue = localStorage.getItem(MATOMO_LS_KEY) || "false"
2226
const isOptedOut = JSON.parse(optedOutValue)
2327
if (isOptedOut) return

0 commit comments

Comments
 (0)