I've created a pretty basic system here at work that does what Google analytics does (extremely simplistic in comparison) and it works quite well, but like Google Analytics it requires each page to reference a JavaScript file. Is there any way to make all of our pages that are served from IIS reference this Javascript file? I would like to capture these stats for every page.
我在这里创建了一个非常基本的系统,可以完成Google分析所做的工作(相比之下非常简单)并且效果很好,但是像Google Analytics一样,它需要每个页面引用一个JavaScript文件。有没有办法让我们从IIS提供的所有页面引用此Javascript文件?我想为每一页捕获这些统计数据。
Any ideas?
Thanks
3 个解决方案
#1
If you're dealing with static HTML files your best bet seems to be this previous question.
如果您正在处理静态HTML文件,那么您最好的选择似乎就是之前的问题。
If you have an ASP site going, and you already have a header or layout file, I'd recommend putting it in there.
如果你有一个ASP站点,并且你已经有一个标题或布局文件,我建议把它放在那里。
#3
This depends on how you build your web site, but most people do this by adding the reference to their templates, layouts, master pages, or whatever term is used in your development platform.
这取决于您构建网站的方式,但大多数人通过添加对其模板,布局,母版页或开发平台中使用的任何术语的引用来实现此目的。
You don't want every page tracked, e.g., pages returning data such as JSON or XML should not be meddled with. This is why it is better to have explicit control over which pages get the analytics javascript added to them.
您不希望跟踪每个页面,例如,不应该使用JSON或XML等返回数据的页面。这就是为什么最好能够明确控制哪些页面添加了分析JavaScript。
#1
If you're dealing with static HTML files your best bet seems to be this previous question.
如果您正在处理静态HTML文件,那么您最好的选择似乎就是之前的问题。
If you have an ASP site going, and you already have a header or layout file, I'd recommend putting it in there.
如果你有一个ASP站点,并且你已经有一个标题或布局文件,我建议把它放在那里。
#2
Hmm, it looks like you are looking for this.
嗯,看起来你正在寻找这个。
#3
This depends on how you build your web site, but most people do this by adding the reference to their templates, layouts, master pages, or whatever term is used in your development platform.
这取决于您构建网站的方式,但大多数人通过添加对其模板,布局,母版页或开发平台中使用的任何术语的引用来实现此目的。
You don't want every page tracked, e.g., pages returning data such as JSON or XML should not be meddled with. This is why it is better to have explicit control over which pages get the analytics javascript added to them.
您不希望跟踪每个页面,例如,不应该使用JSON或XML等返回数据的页面。这就是为什么最好能够明确控制哪些页面添加了分析JavaScript。