mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 23:33:37 +01:00
17 lines
403 B
JavaScript
17 lines
403 B
JavaScript
import { parseCollectRequest } from 'lib/utils';
|
|
import { savePageView } from '../../lib/db';
|
|
|
|
export default async (req, res) => {
|
|
const values = parseCollectRequest(req);
|
|
|
|
if (values.valid) {
|
|
const { type, session_id, url, referrer } = values;
|
|
|
|
if (type === 'pageview') {
|
|
await savePageView(session_id, url, referrer);
|
|
}
|
|
}
|
|
|
|
res.status(200).json({ status: values.valid });
|
|
};
|