Add session_data / session redis to CH.

This commit is contained in:
Brian Cao 2023-05-31 11:42:39 -07:00
parent 8937602f57
commit 2e0d1697e7
21 changed files with 328 additions and 282 deletions

View file

@ -173,7 +173,7 @@
}
};
const send = payload => {
const send = (payload, type = 'event') => {
if (trackingDisabled()) return;
const headers = {
'Content-Type': 'application/json',
@ -183,7 +183,7 @@
}
return fetch(endpoint, {
method: 'POST',
body: JSON.stringify({ type: 'event', payload }),
body: JSON.stringify({ type, payload }),
headers,
})
.then(res => res.text())
@ -205,11 +205,14 @@
return send(getPayload());
};
const identify = data => send({ ...getPayload(), data }, 'identify');
/* Start */
if (!window.umami) {
window.umami = {
track,
identify,
};
}