Count Number of Clicks on a link (Without onclick)

2020-05-10 04:44发布

I have links such as these

"""<a href="http://xyz.com/pz/jjjjj/"><img src="http://xyzsho/mbd.com/42/1319/11110/" alt="" border="0"></a>""""

stored in a mysql database. The user copies these links from some other website and uploads it to the database. These links are now to be displayed on our site. How can I count and store the number of clicks on each link. Here i am unable to use onclick.

I am using PHP and MySQL.

Thanks

1条回答
神经病院院长
2楼-- · 2020-05-10 05:32

You need to rewrite the URL to first hit some other server you can use for statistics gathering, and then redirect the user to their initial URL.

This is the sort of thing used by Twitter or Facebook any time you click one of their off-site links.

Essentially, you're writing a URL shortener.

查看更多
登录 后发表回答