Google Analytics,页面浏览量未正确跟踪

发布于 2024-11-07 18:11:09 字数 822 浏览 0 评论 0原文

我已在我的网站中的访客下的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十二 2024-11-14 18:11:09

确保页面上的其他脚本不使用变量 _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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文