Google Analytics,页面浏览量未正确跟踪
我已在我的网站中的访客下的 GA 帐户中安装了以下 Google 跟踪代码
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
->页面视图未正确显示。在多次访问该网站后,它仅显示页面浏览量为 2。页面浏览总数似乎不正确。 我的跟踪代码有问题吗?请给我一个解决方案。
该代码放置在 结束标记之前,因为它被推荐为放置分析代码的最佳实践。我们将代码放置在所有页面中,GA中的状态为“正在接收数据”。这是一个视频共享网站,我们还使用 JW Player 的 Google Analytics 插件。以下是网站页面 Storybridge.tv/StoryBridge/freespirits/story/fightclub 的 url
我还检查并确认没有其他脚本使用变量 _gat 和 _gaq。
I have installed the below google tracking code in my site
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
In my GA account under visitors -> page views are not showing correctly. After many visits to the site it is showing only page views as 2. The total number of page views doesn't seems correct.
Is there any problem in my tracking code. Please give me a solution on this.
The Code is placed just before the </body>
closing tag as it was recommented as best practice of placing analytics code. We placed the code in all pages and the status in GA is "Receiving Data". It is a video sharing website where we also use Google Analytics Plugin of JW Player. Following is a url to a site page storybridge.tv/StoryBridge/freespirits/story/fightclub
I also checked and confirmed that there is no other script that use the variables _gat and _gaq.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保页面上的其他脚本不使用变量 _gat 和 _gaq,因为这些是异步跟踪代码使用的全局变量。只要您页面上的其他脚本不使用这些变量,您自己的脚本中的跟踪代码就不应该受到其他干扰。
Make sure that other scripts on your pages do not use the variables _gat and _gaq, since those are global variables used by the asynchronous tracking code. As long as those variables are not used by other scripts on your pages, there should be no other interference with the tracking code from your own scripts.