Skip to content
Inqetra
Documentation

Add analytics to Nuxt

Declared in app.head.script, so no template needs editing.

Nuxt takes it as configuration rather than markup: an entry in app.head.script in nuxt.config.ts, and no template is touched.

That also means it applies everywhere at once, including routes rendered on the server, without a layout having to remember to include it.

nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          src: "https://collect.inqetra.com/inqetra.js",
          defer: true,
          "data-site": "9f1c4b2e-7a30-4d51-b8c6-2e5a0d7f3c11",
        },
      ],
    },
  },
});

Worth knowing

9f1c4b2e-7a30-4d51-b8c6-2e5a0d7f3c11 is a placeholder. Yours is issued when you add a domain and is shown in the dashboard next to the snippet.

After it is in

Load a page and check the realtime view: it counts the last five minutes, so your own visit should appear within seconds. Then custom events covers naming the things that matter to you.