mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Updated initialization process.
This commit is contained in:
parent
bba584a09f
commit
291c64f7b0
@ -222,6 +222,16 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
if (!initialized) {
|
||||||
|
track();
|
||||||
|
handlePathChanges();
|
||||||
|
handleTitleChanges();
|
||||||
|
handleClicks();
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const track = (obj, data) => {
|
const track = (obj, data) => {
|
||||||
if (typeof obj === 'string') {
|
if (typeof obj === 'string') {
|
||||||
return send({
|
return send({
|
||||||
@ -255,19 +265,10 @@
|
|||||||
let initialized;
|
let initialized;
|
||||||
|
|
||||||
if (autoTrack && !trackingDisabled()) {
|
if (autoTrack && !trackingDisabled()) {
|
||||||
handlePathChanges();
|
if (document.readyState === 'complete') {
|
||||||
handleTitleChanges();
|
init();
|
||||||
handleClicks();
|
} else {
|
||||||
|
document.addEventListener('readystatechange', init, true);
|
||||||
const init = () => {
|
}
|
||||||
if (document.readyState === 'complete' && !initialized) {
|
|
||||||
track();
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('readystatechange', init, true);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
})(window);
|
})(window);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user