diff --git a/src/tracker/index.js b/src/tracker/index.js index cc6b8dbb..97bf3bb0 100644 --- a/src/tracker/index.js +++ b/src/tracker/index.js @@ -193,17 +193,21 @@ /* Tracking functions */ const trackingDisabled = () => + !website || (localStorage && localStorage.getItem('umami.disabled')) || (domain && !domains.includes(hostname)); const send = async (payload, type = 'event') => { if (trackingDisabled()) return; + const headers = { 'Content-Type': 'application/json', }; + if (typeof cache !== 'undefined') { headers['x-umami-cache'] = cache; } + try { const res = await fetch(endpoint, { method: 'POST',