【问题标题】:google tag manager how to set environment name谷歌标签管理器如何设置环境名称
【发布时间】:2020-08-06 00:55:43
【问题描述】:

我正在使用谷歌标签管理器和谷歌分析与名为vue-gtm的插件

我在同一个容器下的 google tag manager 中创建了 3 个环境。

作为用户定义的变量,我从环境中创建了名为 GA 的look up table,并在那里设置了输入变量{{ Environment Name}}。输出变量如下:

  1. 开发 - ua_123_1
  2. 暂存 - ua_456_1
  3. 产品 - ua_789_1

这是 vue-gtm 的样子:

Vue.use(VueGtm, {
  id: config.services.googleTag.id,
  queryParams: config.services.googleTag.gtm_auth ? { // Add url query string when load gtm.js with GTM ID (optional)
    gtm_auth: config.services.googleTag.gtm_auth,
    gtm_preview: config.services.googleTag.gtm_preview,
    gtm_cookies_win: config.services.googleTag.gtm_cookies_win,
  } : {},
  defer: false, // defaults to false. Script can be set to `defer` to increase page-load-time at the cost of less accurate results (in case visitor leaves before script is loaded, which is unlikely but possible)
  enabled: true, // defaults to true. Plugin can be disabled by setting this to false for Ex: enabled: !!GDPR_Cookie (optional)
  debug: true, // Whether or not display console logs debugs (optional)
  vueRouter: router, // Pass the router instance to automatically sync with router (optional)
});

进入站点后,在分析中没有任何反应,因为在调试中,我仍然可以看到环境名称变量设置为:'Preview Environment 2 2020-08-05 071543'。不知道为什么。

我应该是应该从代码中设置这个的人吗?我不这么认为,因为我正在使用gtm_preview 和所有这些,以便它可以自动解决这个问题。有什么想法吗?

【问题讨论】:

    标签: javascript vue.js google-tag-manager


    【解决方案1】:

    如果您想调试特定环境 - 您需要准确预览此环境(即“dev”)

    GTM -> Admin -> Environments -> “dev” -> Actions -> Share Link -> 输入目标 URL -> 复制生成的预览链接 -> 转到生成的链接 -> 现在您将在变量中看到“dev”

    tagassistant debug variables screenshot

    注意:目标 URL - 您配置此环境的站点(添加了身份验证、预览和 cookie 查询参数)。也可以是本地主机

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-13
      • 1970-01-01
      • 1970-01-01
      • 2015-08-26
      • 2020-10-22
      • 2014-07-15
      相关资源
      最近更新 更多