Learn Nuxt with a Collection of 100+ Tips!

vercel-analytics

Vercel Analytics integration for Nuxt

Nuxt Vercel Analytics

Nuxt Vercel Analytics

npm versionnpm downloadsLicenseNuxt

Vercel Analytics integration for Nuxt

๐Ÿ“ Features

  • ๐Ÿš€ Zero-config
  • ๐Ÿ“ฅ Auto-imports

๐Ÿ”ง Setup

npx nuxi@latest module add vercel-analytics

That's it! Vercel Analytics is now integrated in your Nuxt app โœจ

โš™๏ธ Configuration

// app.config.ts
export default defineAppConfig({
  vercelAnalytics: {
    mode: "auto",
    debug: true,
    beforeSend: (event) => {
      if (event.url.includes("/private")) return null;

      return event;
    },
  },
});

๐Ÿ“ˆ Custom Events

To track an event, call vercelTrack and pass in a string representing the event name as the first argument

const onSignup = () => {
  vercelTrack("Signup");
  // ...other logic
};

Custom data

You can also pass custom data along with an event by passing an object as the second argument

const onSignup = () => {
  vercelTrack("Signup", { location: "footer" });
  // ...other logic
};