2015-08-20 00:22
浏览 77

将Google Analytics添加到PHP网站

I'm new to Google Analytics and am trying to add it to my existing PHP website. At this stage I only have access to the Content Management System which is used for creating new pages and inserting content. As far as I am aware the page already has a Classic Analytics code (ga.js) which was put there by the company who created the website.

According to the following page from Google I should be able to add a Universal Analytics tracking code (analytics.js) to my content and it should work harmoniously.

I've gone ahead and added the tracking code at the end of my content for each of the pages on the site.

Unfortunately I don't think the pages views are being shown accurately when I log in and look at the stats. They are being displayed as follows:

enter image description here

Where are all the other pages? Why aren't they coming up on the list? Am I making a beginners mistake?

To make this easier for you to see what I'm talking about, the site I'm working on is This Site.


I've added the Google Analytics Debug add on for Chrome. It seems to be showing the same error on each page I go to in the browser. Here's an example:

Error: community.php? id=66:484 Uncaught SyntaxError: Unexpected Identifier


Unfortunately I had forgotten that the Content Management System on the website uses square brackets to know where to insert html code for images. What a pain. This is what caused the two different looking tracking codes as you can see in the answer below. Anyway, at least I know what was causing problem. Thanks again Sina!

图片转代码服务由CSDN问答提供 功能建议

我是谷歌分析的新手,正在尝试将其添加到我现有的PHP网站。 在此阶段,我只能访问用于创建新页面和插入内容的内容管理系统。 据我所知,该页面已经有一个经典分析代码(ga.js),由创建该网站的公司提供。

根据Google的以下页面我 应该能够将通用分析跟踪代码(analytics.js)添加到我的内容中,它应该和谐地工作。

我已经开始并添加了 在我的内容结尾处跟踪网站上每个网页的代码。

不幸的是,当我登录并查看统计信息时,我认为页面视图没有准确显示。 它们显示如下:

所有其他页面在哪里? 他们为什么不出现在名单上? 我是否犯了初学者错误?



我已为Chrome添加了Google Analytics Debug添加功能。 它似乎在我在浏览器中访问的每个页面上显示相同的错误。 以下是一个示例:

http :// ID = 66

错误:吗 community.php \ nid = 66:484 未捕获的SyntaxError: 未预期的标识符


不幸的是我忘记了内容 网站上的管理系统使用方括号来知道在哪里插入图像的html代码。 太痛苦了。 这就是导致两个不同的跟踪代码的原因,如下面的答案所示。 无论如何,至少我知道是什么导致了问题。 再次感谢新浪!

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题