Counting clicks on anchor tag

2019-08-18 07:42发布

I have a <a href="" > </a> on a page on my webiste. I wanted to count the number of clicks on this link by the user and display it. How can this be done?

2条回答
走好不送
2楼-- · 2019-08-18 08:23

href can have a javascript function call that can do the count and redirect the user to the original page.

Or you can point the href to a server side page that can do the count and redirect the user to the original page.

查看更多
霸刀☆藐视天下
3楼-- · 2019-08-18 08:41

best way to represent a counter for each a tag on your document and store the data with jquery.data, increasing the counter on each click,

example shown in here : http://jsfiddle.net/ShlomiKomemi/dvdPd/13/

查看更多
登录 后发表回答