开发者

Tracking how many times an image loads and gets clicked

A client asked me to create an image for him, and he wants me to set up a script that will track how many times the image is clicked AND how many times the image is loaded. He wants this displayed for him in the WP dashboard so I don't think I can use the servers access logs. I have never done anything like this, s开发者_高级运维o I turn to the stackoverflow community. :)

Can somebody just point me in the right direction? Thanks a million.


The easiest way is probably just to use to the access logs of your web server (for Apache, the most common one, check: http://httpd.apache.org/docs/2.0/logs.html). Here every hit (both the link page and the image) is logged, so you can get the information from that.

Most web servers have some tools available that can make this a bit easier than counting by hand (or with grep); just search the web for your web server + log analyzer (e.g. http://awstats.sourceforge.net/ for Apache). If you're not hosting the site yourself, chances are that your web host has pre-installed such a tool for you already.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜