3

I have a site affiliated with a university and we want to link to another site that has a certain teaching program.

How can we track the number of times this link has been clicked from within our website?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
wootwoot
  • 31
  • 1
  • 1
  • 2

5 Answers5

3

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.

AnthonyHurst
  • 133
  • 7
2

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

It Grunt
  • 3,300
  • 3
  • 21
  • 35
  • how sophisticated is the code to do this? I know a little javascript. Is this code pretty much plug and play? – wootwoot Jan 12 '11 at 20:11
  • 1
    You can definitely use GA... or if you want to own your own data, check out the open source alternative, Piwik (http://piwik.org/) – Ryan Jan 12 '11 at 20:12
  • GA is pretty easy to configure and get running. To give you an idea of how the tagging and data collection works, When you click on a link, a call will be made to GA or WebTrends Analytics server. In the case of WebTrends, a 1K 1 X 1 px GIF is requested over the HTTP GET request. The request also contains params that contain data about your page, link, and any metadata you have specified on your page. The Analytics server can provide you with different levels of reporting tools to look at the usage data of your site/page. – It Grunt Jan 12 '11 at 21:41
2

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.

Wooble
  • 87,717
  • 12
  • 108
  • 131
  • i thought of that but the problem was if someone accidentally clicked the link or clicked it and didn't actually leave the page the numbers would be incorrect. pardon me if i've misunderstood you. – wootwoot Jan 12 '11 at 20:08
  • If the page on your site that's linked does nothing but serve an immediate redirect, clicking the link accidentally will be exactly like they clicked a direct link accidentally; there's no way to detect intent either way. The only way they wouldn't leave the page is if they disabled redirection in their browser, which is incredibly rare. – Wooble Jan 12 '11 at 23:43
1

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.

Jason Small
  • 1,064
  • 1
  • 13
  • 29
1

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.

Sampsa Suoninen
  • 624
  • 4
  • 9