@mcansh/remix-web-vitals
TypeScript icon, indicating that this package has built-in type declarations

0.3.6 • Public • Published

Vercel Remix Web Vitals

Save Web Vitals to Vercel

Installation

# npm
npm i @mcansh/remix-web-vitals

# pnpm
pnpm i @mcansh/remix-web-vitals

# yarn
yarn add @mcansh/remix-web-vitals

# bun
bun add @mcansh/remix-web-vitals

Usage

import { WebVitals } from "@mcansh/remix-web-vitals";

export async function loader() {
  return json({ analyticsId: process.env.VERCEL_WEB_ANALYTICS_ID });
}

export default function App() {
  let { analyticsId } = useLoaderData<typeof loader>();

  return (
    <html lang="en">
      <head>
        <meta charSet="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <Meta />
        <Links />
      </head>
      <body>
        <Outlet />
        <ScrollRestoration />
        <Scripts />
        <LiveReload />
        {analyticsId ? <WebVitals analyticsId={analyticsId} /> : null}
      </body>
    </html>
  );
}

Package Sidebar

Install

npm i @mcansh/remix-web-vitals

Weekly Downloads

3

Version

0.3.6

License

MIT

Unpacked Size

19 kB

Total Files

8

Last publish

Collaborators

  • mcansh