Google Analytics和Tag Manager,支持自定义页面路径? [英] Google Analytics and Tag Manager, support for custom page paths?

查看:148
本文介绍了Google Analytics和Tag Manager,支持自定义页面路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始使用Google跟踪代码管理器。在我的分析设置中,我发送自定义页面路径来规范化或统一页面路径,因为在Web应用程序中,同一页面可能有许多不同的URL。示例:

  /?action =查看
/查看
/查看页面

并在我的GA页面发送给我:

  ga('send','pageview','/ view'); 

我无法弄清楚如何使用GTM进行设置。我有权访问服务器端,以便在那里进行必要的更改。



我试图在dataLayer链接中设置它:

 < ;脚本> 
dataLayer = [{$ b $'pageview':'/ view'
}];
< / script>

我可以在数据层调试/预览中看到数据,但它并未出现实际上被设置为页面路径。我在猜测GTM管理员需要设置什么来映射dataLayer的值?

解决方案

如果你想推pagepath作为dataLayer参数,那么您需要 $ b


  1. 配置一个dataLayer类型变量,其值为 pageview (这是您在dataLayer中定义的值如何传递到GTM中)。
  2. 在您的基本pageview标记中,您需要设置 page 字段(在要设置的字段下)和dataLayer类型变量的名称的值。

值得一提的是,您的dataLayer声明必须位于GTM容器之前。通过这种方式,您可以将您的浏览量设置为在常规的页面视图触发器上触发。


Just starting with Google Tag Manager. In my analytics setup I am sending custom page paths to canonicalize or "unify" the page path since in the web app there can be many different URLs for the same page. Example:

/?action=view
/view
/view_page

and in my GA for that page I'm sending:

ga('send', 'pageview', '/view');

I can't figure out how to set this up with GTM. I have access to the server side so I can make any necessary changes there.

I tried setting it in the dataLayer link this:

<script>
  dataLayer = [{
    'pageview': '/view'
  }];
</script>

And I can see the data in the datalayer debug/preview, but it doesn't appear this is actually being set as the page path. I am guessing something needs to be set up on the GTM admin to map the dataLayer value?

解决方案

If you want to push the pagepath as a dataLayer parameter, then you would need to

  1. configure a dataLayer type variable with the value of pageview (this is how the value you've defined in the dataLayer gets passed into GTM).
  2. In your base pageview tag, you would need to set the page field (under "Fields to Set") with the value of the name of the dataLayer type variable.

It's worth mentioning that your dataLayer declaration MUST come before the GTM container. In this way, you can set your pageview to fire on the regular Page View trigger.

这篇关于Google Analytics和Tag Manager,支持自定义页面路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆