How do I keep track of how many times an external link is clicked?

坚强是说给别人听的谎言 提交于 2019-12-06 16:03:56

I would use jquery and/or ajax to touch a page in the background (ajax) that counts hits whenever a link is clicked and then proceed to allow the link do what it does.

You can use web analytics tools such as Google Analytics or commercial software such as WebTrends.

Instead of directly providing the external link, link to a page on your own site that redirects to the link, and it will be logged like every other request.

The sky is really the limit when it comes to link tracking. It really depends on your expertise.

You can use a service like bit.ly to track the clicks on the link. Bit.ly is mostly used a s shortner service, but if you sign up for bit.ly (actually make an account) You can keep track on the links that you generate and how much they are clicked.

If you want to install something on your server to track the links you can use something like: http://www.phpjunkyard.com/php-click-counter.php Its a simple redirect script that where you give it a link, and it will give you back a link that it can track. It keeps track of all the click. This script is super simple and does not require you to use a mysql database and you don't have to have a huge knowledge of programming to install it.

Most reliable method is using a redirector to measure the traffic going through, no need for JavaScript (e.g. the phpjunkyard.com link given) as long as you can rely on your server to redirect without problems.

If a server side option is not available, using a web-analytics tool simply to count link clicks doesn't make sense, so the JavaScript option could be used, but you still need something to count the clicks in to.

If you would like to us a web-analytics tool to e.g. better understand your visitors, it's a different story; All (not all require it, but all use it if possible) the WA tools use a 1x1 pixel GIF to record calls and read the incoming data. GA is free, but you would have to code the link click (simple though). Piwik hosting is available really cheap and would do the trick. WebTrends and other tools are way too hardcore for this kind of requirement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!