简体   繁体   English

如何使用google跟踪代码管理器为单页应用跟踪网页浏览量?

[英]How to track page views with google Tag Manager for a single page app?

I have built a single page app using vue.js I am trying to track users on my site using google tag manager. 我使用vue.js构建了一个单页应用程序我试图使用谷歌标记管理器跟踪我的网站上的用户。 I have it up and running but its not tracking page changes. 我已经启动并运行但它没有跟踪页面更改。 I set it up google tag manager as below. 我将其设置为google tag manager,如下所示。

I have tried a couple of different variables but I am just randomly guessing at this point. 我尝试了几个不同的变量,但我只是随意猜测。 Current Setup As you can see from the images I have tag setup and triggered by Page view and History change. 当前设置从图像中我可以看到我有标签设置并由页面视图和历史记录更改触发。 setting the {{page URL}} field to {{New History Fragment}} 将{{page URL}}字段设置为{{New History Fragment}}

My URLS look something like 我的URL看起来像

http://website.com/#/section1/page1 http://website.com/#/section1/page1
which changes to 改为
http://website.com/#/section2/page1 http://website.com/#/section2/page1
etc.... 等等....

I need to be able to track these changes but analytics only thinks one page was visited. 我需要能够跟踪这些更改,但分析只会认为访问了一个页面。 " / " “/”

Any ideas would be appreciated. 任何想法,将不胜感激。

Welcome to Stackoverflow! 欢迎来到Stackoverflow!

I hate to be "that guy", but have you considered using the vue-analytics library? 我讨厌成为“那个人”,但你考虑过使用vue-analytics库吗? I have used it in a pet project with success (only the basic functionality though). 我已经在宠物项目中成功使用它(虽然只有基本功能)。 You can check it out here: https://github.com/MatteoGabriele/vue-analytics 你可以在这里查看: https//github.com/MatteoGabriele/vue-analytics

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM