mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 07:13:37 +01:00
Removed polyfills from tracker. Switched to XMLHttpRequest.
This commit is contained in:
parent
023adafa39
commit
b19889638a
@ -23,6 +23,7 @@ export const useSession = use(async (req, res, next) => {
|
|||||||
try {
|
try {
|
||||||
session = await getSession(req);
|
session = await getSession(req);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
return serverError(res, e.message);
|
return serverError(res, e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import 'promise-polyfill/src/polyfill';
|
import { doNotTrack, hook } from '../lib/web';
|
||||||
import 'unfetch/polyfill';
|
|
||||||
import { doNotTrack, hook, post } from '../lib/web';
|
|
||||||
import { removeTrailingSlash } from '../lib/url';
|
import { removeTrailingSlash } from '../lib/url';
|
||||||
|
|
||||||
(window => {
|
(window => {
|
||||||
@ -32,6 +30,20 @@ import { removeTrailingSlash } from '../lib/url';
|
|||||||
|
|
||||||
/* Collect metrics */
|
/* Collect metrics */
|
||||||
|
|
||||||
|
const post = (url, data, callback) => {
|
||||||
|
const req = new XMLHttpRequest();
|
||||||
|
req.open('POST', url, true);
|
||||||
|
req.setRequestHeader('Content-Type', 'application/json');
|
||||||
|
|
||||||
|
req.onreadystatechange = () => {
|
||||||
|
if (req.readyState === 4) {
|
||||||
|
callback && callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
req.send(JSON.stringify(data));
|
||||||
|
};
|
||||||
|
|
||||||
const collect = (type, params, uuid) => {
|
const collect = (type, params, uuid) => {
|
||||||
const payload = {
|
const payload = {
|
||||||
website: uuid,
|
website: uuid,
|
||||||
@ -133,5 +145,7 @@ import { removeTrailingSlash } from '../lib/url';
|
|||||||
history.replaceState = hook(history, 'replaceState', handlePush);
|
history.replaceState = hook(history, 'replaceState', handlePush);
|
||||||
|
|
||||||
pageView(currentUrl, currentRef);
|
pageView(currentUrl, currentRef);
|
||||||
|
|
||||||
|
loadEvents();
|
||||||
}
|
}
|
||||||
})(window);
|
})(window);
|
||||||
|
Loading…
Reference in New Issue
Block a user