Essential module for a healthy Nuxt.js

Dalibor Gogic
Dalibor Gogic

Web Vitals is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience on the web.


npm i -D nuxt-vitals
export default {
  buildModules: [
    ['nuxt-vitals', { 
      // Tracking ID (required) { string }
      // Replace UA-XXXXXXXX-X by your Google Analytics tracking ID.
      trackingID: 'UA-XXXXXXXX-X',
      // Event Category (optional) { string }, default 'Web Vitals'
      eventCategory: 'Nuxt Vitals',
      // Debug (optional) { number } default 0 
      debug: 0

Note: it's safe to use module scripts in legacy browsers because unknown script types are ignored.