<< Back

Setting up UMAMI script in Nuxtjs

Umami it's an Open Source alternative to Google Analytics.

If you are worried about data privacy you may want to give it a try.

When setting up Umami on a Nuxtjs site you may get stucked when getting your site code:

umami-tracking-code.PNG

You may be wondering how to add it to your NUXTjs site's head, specially with that data attribute.

To add it on a Nuxt site you'll edit your nuxt.config.js file and add it to the head section like this:

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    script: [
      {
        src: "https://umami.mauri.co/umami.js",
        async: true,
        'data-website-id': '4be0f896-0a4a-4885-ba43-01137f367caf'
      },
  },

Please remember to put the right scr and data-website-id :)