mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 21:27:20 +01:00
Merge dev.
This commit is contained in:
commit
be1b2fc272
88 changed files with 4120 additions and 21010 deletions
|
|
@ -46,6 +46,7 @@
|
|||
url: currentUrl,
|
||||
referrer: currentRef,
|
||||
tag: tag ? tag : undefined,
|
||||
id: identity ? identity : undefined,
|
||||
});
|
||||
|
||||
const hasDoNotTrack = () => {
|
||||
|
|
@ -233,22 +234,35 @@
|
|||
}
|
||||
};
|
||||
|
||||
const track = (obj, data) => {
|
||||
if (typeof obj === 'string') {
|
||||
const track = (name, data) => {
|
||||
if (typeof name === 'string') {
|
||||
return send({
|
||||
...getPayload(),
|
||||
name: obj,
|
||||
data: typeof data === 'object' ? data : undefined,
|
||||
name,
|
||||
data,
|
||||
});
|
||||
} else if (typeof obj === 'object') {
|
||||
return send(obj);
|
||||
} else if (typeof obj === 'function') {
|
||||
return send(obj(getPayload()));
|
||||
} else if (typeof name === 'object') {
|
||||
return send({ ...name });
|
||||
} else if (typeof name === 'function') {
|
||||
return send(name(getPayload()));
|
||||
}
|
||||
return send(getPayload());
|
||||
};
|
||||
|
||||
const identify = data => send({ ...getPayload(), data }, 'identify');
|
||||
const identify = (id, data) => {
|
||||
if (typeof id === 'string') {
|
||||
identity = id;
|
||||
}
|
||||
|
||||
cache = '';
|
||||
return send(
|
||||
{
|
||||
...getPayload(),
|
||||
data: typeof id === 'object' ? id : data,
|
||||
},
|
||||
'identify',
|
||||
);
|
||||
};
|
||||
|
||||
/* Start */
|
||||
|
||||
|
|
@ -265,6 +279,7 @@
|
|||
let cache;
|
||||
let initialized;
|
||||
let disabled = false;
|
||||
let identity;
|
||||
|
||||
if (autoTrack && !trackingDisabled()) {
|
||||
if (document.readyState === 'complete') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue