Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Update index.js

榆木5d8fb2f79191
diff --git a/tracker/index.js b/tracker/index.js
index 4d680c7e3..7c727326e 100644
--- a/tracker/index.js
+++ b/tracker/index.js
@@ -162,11 +162,16 @@
const send = payload => {
if (trackingDisabled()) return;
-
+ const headers = {
+ 'Content-Type': 'application/json'
+ };
+ if (typeof cache !== 'undefined') {
+ headers['x-umami-cache'] = cache;
+ }
return fetch(endpoint, {
method: 'POST',
body: JSON.stringify({ type: 'event', payload }),
- headers: { 'Content-Type': 'application/json', ['x-umami-cache']: cache },
+ headers: headers
})
.then(res => res.text())
.then(text => (cache = text));