UNPKG

@nuxtjs/web-vitals

Version:
16 lines (15 loc) 383 B
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); }