分析页面计数器,数据存储在MySQL数据库中

Like this question, I wish to keep track of the number of page views. However, unlike that question, I would like to use MySQL to store the data. How do you propose that I set up my table to efficiently sore the data related to that specific page?

I would also like to apply some "intelligence" to the page counter. How can I keep track of the unique pageviews (similar to SO) in addition to the overall pageviews? How should I modify the table from above to suit these changes?

Additionally, could I use this information to track advertisement "views"? If so, how? If not, then I'll gladly post that as another question.

Thanks.

#0

This could be the structure of the table you would record every-single-hit.

id | date | ip | user-cookie | agent

And then for performance reasons you could have another table that would be updated by a cron-job.

id | unique-hits

How to define a unique user?
This is a bit of a grey area where your own levels of paranoia kick in. A unique user can be a registered user and that should count as really one hit per user. You can follow the flawed one ip / one user. You can mix and match IP's and user agent's to try and better debunk unique users. Time can also be put into the mix, say every IP after x days will count as a new user.

Do you have a digital fingeprint?
Flash version, and other odities may cause your browser to be "different" from all other browsers creating a more unique view of yourself. Hit the great https://panopticlick.eff.org/ for a preview of what you may look like to a server.

How does Google Analytics does it?
Aparenttly they go cookie all the way.

推荐文章

jquerycss不工作,但Animate工作正常

jquerycss不工作,但Animate工作正常

推荐文章

返回值为const reference时如何返回“not found”

返回值为const reference时如何返回“not found”

推荐文章

我能用吗document.getelmentbytagname在硒的geteval方法中?

我能用吗document.getelmentbytagname在硒的geteval方法中?

推荐文章

具有类化基类的C++ CRTP?

具有类化基类的C++ CRTP?

推荐文章

正则表达式字符串替换。

正则表达式字符串替换。

推荐文章

jquery 1.6.1歌剧院废墟背景

jquery 1.6.1歌剧院废墟背景

推荐文章

ResponseXML返回为null或未定义

ResponseXML返回为null或未定义

推荐文章

如何检查对象是否为空?

如何检查对象是否为空?

推荐文章

如何将输出从cliphp传递到bat文件

如何将输出从cliphp传递到bat文件

推荐文章

氨酸盐事务处理。提交()

氨酸盐事务处理。提交()

推荐文章

如何加载动态库?

如何加载动态库?

推荐文章

Eclipse不会启动,但不会显示错误

Eclipse不会启动,但不会显示错误

推荐文章

在变量中写入图像源,并在jquery中更改css时使用该变量

在变量中写入图像源,并在jquery中更改css时使用该变量

推荐文章

WinINet InternetGetProxyInfo:错误1003错误\u无法完成

WinINet InternetGetProxyInfo:错误1003错误\u无法完成

推荐文章

php、mysql数据库和unittesting

php、mysql数据库和unittesting

推荐文章

Javascript:使用即时调用创建对象时如何访问公共成员变量

Javascript:使用即时调用创建对象时如何访问公共成员变量