umami/queries/analytics/pageview/savePageView.js

17 lines
383 B
JavaScript
Raw Normal View History

2022-07-16 01:47:38 +02:00
import { prisma, runQuery } from 'lib/db';
2022-07-12 23:14:36 +02:00
import { URL_LENGTH } from 'lib/constants';
export async function savePageView(website_id, session_id, url, referrer) {
return runQuery(
prisma.pageview.create({
data: {
website_id,
session_id,
url: url?.substr(0, URL_LENGTH),
referrer: referrer?.substr(0, URL_LENGTH),
},
}),
);
}