mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 13:17:19 +01:00
Updated id logic.
This commit is contained in:
parent
340cdce1dc
commit
e8a933f80e
2 changed files with 21 additions and 15 deletions
|
|
@ -233,28 +233,34 @@
|
|||
}
|
||||
};
|
||||
|
||||
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, ...getPayload().id });
|
||||
} 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, id = undefined) => {
|
||||
if (id && typeof id === 'string') {
|
||||
const identify = (id, data) => {
|
||||
if (typeof id === 'string') {
|
||||
identity = id;
|
||||
}
|
||||
/* Clear cache since this will result in another session */
|
||||
|
||||
cache = '';
|
||||
send({ ...getPayload(), data }, 'identify');
|
||||
return send(
|
||||
{
|
||||
...getPayload(),
|
||||
data: typeof id === 'object' ? id : data,
|
||||
},
|
||||
'identify',
|
||||
);
|
||||
};
|
||||
|
||||
/* Start */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue