@nuxtjs/web-vitals
Version:
Web Vitals for Nuxt.js
16 lines (15 loc) • 383 B
JavaScript
import { logDebug, send } from "../utils.mjs";
export function sendToAnalytics({ fullPath, href }, metric, options) {
const body = {
path: fullPath,
href,
...metric
};
if (options.debug) {
logDebug(metric.name, JSON.stringify(body, null, 2));
}
const blob = new Blob([JSON.stringify(body)], {
type: "application/json"
});
send(options.url, blob);
}