【问题标题】:What is the difference between @nuxtjs/google-gtag @nuxtjs/gtm @nuxtjs/google-analytics and vue-gtag, what to use for GA4?@nuxtjs/google-gtag @nuxtjs/gtm @nuxtjs/google-analytics 和 vue-gtag 有什么区别,GA4 用什么?
【发布时间】:2021-09-26 03:26:55
【问题描述】:

整个分析方面的新手,发现这非常令人困惑

我想在我的 nuxt ssr webapp 中使用 Google Analytics 4,但我对选项的数量感到不知所措

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 似乎是除了 vue-gtag 和 nuxt/gtm 之外的另一个库

我什至应该使用什么? 我只想在我的 nuxt.js SSR 应用中集成 Google Analytics 4

【问题讨论】:

标签: vue.js google-analytics nuxt.js google-analytics-4 gtag.js


【解决方案1】:
  1. Create a GA account and a GA4 property 如果您还没有。记下您的测量 ID(“G-”ID)。同页可以帮你找到id。

  2. 使用nuxtjs/google-gtag。页面包含设置帮助。

  3. 在代码中传递配置时,请使用以下格式:

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

只是为了比较,对于 Universal Analytics(GA 的早期版本),ID 看起来像 UA-XXXX-XX,而不是 G-XXXXXXXX。通过Google Analytics 4 properties tag and instrumentation guide了解更多信息。

【讨论】:

    猜你喜欢
    • 2021-05-24
    • 2021-09-30
    • 2022-10-25
    • 2020-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-06
    相关资源
    最近更新 更多