umami/queries/analytics/pageview/savePageView.js
2022-07-15 16:47:38 -07:00

17 lines
383 B
JavaScript

import { prisma, runQuery } from 'lib/db';
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),
},
}),
);
}