3

Newbie to this whole analytics thing and am finding this very confusing

I wanted to use Google Analytics 4 in my nuxt ssr webapp and am feeling overwhelmed with the number of options

Quick issue on nuxtjs/google-analytics says it does not support GA4 and is asking me to use nuxt/gtm

stackoverflow answer on the same question says use vue-gtag

Google's documentation says it covers analytics ads etc

nuxt/google-gtag seems to be another library apart from vue-gtag and nuxt/gtm

what am I even supposed to use? I just want to integrate Google Analytics 4 on my nuxt.js SSR app

PirateApp
  • 5,433
  • 4
  • 57
  • 90
  • 1
    This one may maybe help: https://stackoverflow.com/a/68504060/8816585 – kissu Sep 26 '21 at 09:44
  • This issue can also help, here you can find the difference between the different modules / libraries, and what you should use according to your needs. https://github.com/nuxt-community/gtm-module/issues/82 – ggirodda Oct 18 '21 at 18:04

1 Answers1

4
  1. Create a GA account and a GA4 property if you have not already. Keep a note of your Measurement Id (the "G-" Id). The same page can help you to find the id.

  2. Use nuxtjs/google-gtag. Page includes setup help.

  3. When passing the config in your code, use this format:

 // example config
 'google-gtag':{
   id: 'G-XXXXXXXX',  // your measurement id
   ... // rest of the config
  }

Just to compare, for Universal Analytics (the previous version of GA), the Id would look like UA-XXXX-XX, instead of G-XXXXXXXX. Learn more with Google Analytics 4 properties tag and instrumentation guide.

Minhaz Kazi
  • 3,115
  • 1
  • 10
  • 20
  • This link says that the google-gtag is deprecated, instead gtm is the new one. https://stackoverflow.com/questions/65752819/how-to-use-google-tags-in-nuxt-js – m yadav Sep 21 '22 at 14:54