Skip to content

Commit 965e6bb

Browse files
authored
Merge pull request #15905 from ethereum/matomo-dnt
feat: respect doNotTrack preference for Matomo
2 parents 404ecd8 + 6bdac20 commit 965e6bb

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)