refactor: change tracker path
This commit is contained in:
parent
b9d9391342
commit
e53de57720
@ -43,7 +43,7 @@ websiteRouter.post(
|
||||
.matches(/event|identify/i)
|
||||
),
|
||||
async (req, res) => {
|
||||
// https://github1s.com/umami-software/umami/blob/master/src/pages/api/send.ts
|
||||
// Reference: https://github1s.com/umami-software/umami/blob/master/src/pages/api/send.ts
|
||||
|
||||
const { type, payload } = req.body;
|
||||
const {
|
||||
|
@ -47,10 +47,11 @@
|
||||
};
|
||||
|
||||
const getPath = (url) => {
|
||||
if (url.substring(0, 4) === 'http') {
|
||||
return '/' + url.split('/').splice(3).join('/');
|
||||
}
|
||||
try {
|
||||
return new URL(url).pathname;
|
||||
} catch (e) {
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
||||
const getPayload = () => ({
|
||||
@ -199,7 +200,8 @@
|
||||
headers,
|
||||
})
|
||||
.then((res) => res.text())
|
||||
.then((text) => (cache = text));
|
||||
.then((text) => (cache = text))
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const track = (obj, data) => {
|
||||
|
Loading…
Reference in New Issue
Block a user