Click to See Complete Forum and Search --> : Link Counting


Launchnet
03-30-2006, 09:51 AM
My question is: Can someone help me with a counter that can be used to count how many times a link is activated. I use Andale counters for page counting, but I need a link counter.

INTERESTING INFO FOR MEN (Ladies you can help your man understand how important this is)

What is excitement. It's exciting when you find out you have prostate cancer and have it cured in 1 treatment. And, no cancer now for over 9 months.

Men, get your blood tested (called PSA) for prostate cancer each year. There are no symptoms. Guess what, approximately 50% of all men get it and you really don't want it. You have to catch it early.

Go to our site and use keyword "Prostate Cancer"

Comtrad
03-30-2006, 10:01 AM
Google Analytics (http://www.google.com/analytics/)

Comtrad
03-30-2006, 10:12 AM
Here is a picture of it. (http://www.comtradcables.com/images/urchin.jpg)

Launchnet
03-30-2006, 10:02 PM
I have many links out to various other websites, and I give each link credit to the company I link to. I don't steal credits or imply that they may be part of my site.

As an example, let's say that I have 10 pages with miscellaneous links on each page.

What I need is a counter that tells me how many hits I have on each individual link where I want to assign a link. The link count can even be next to the link if necessary.

Thanks for the picture you sent me. In looking at it, I doubt it will do what I am looking for.

Before I do all the work of researching this, I think you can probably give me the answer off the top of your head.

Thanks
Matt

bathurst_guy
04-01-2006, 08:33 PM
I think PHP would be your answer. Relocated thread to PHP Forum.

Sheldon
04-02-2006, 04:36 AM
give each link an id.

then refer each link to a counter page on your site. and add the id into a database, then at the end of the month just count the entries and reset the databse or something simalar. then redirect them to that site.

for instance
<a href="counter.php?id=http://www.domain.com">http://www.domain.com</a>

and on counter.php

<?php
$url = $_GET['id'];
$date = date(dMYh:m:s);
$q = "INSERT INTO counter (`date`) values ('$date') WHERE url = '".$url."' ";
$s = mysql_query($q);

header("Location : ".$url);
?>

the tree
04-02-2006, 06:09 AM
Sheldons solution is great if you're already into databases, but if you want a simpler solution (but the same idea) then you can do it with just a text file.<?php
$url = $_GET['id'];
$date = date(dMYh:m:s);
// The 'a' in fopen(); means to open the file
// for writing only and to place the pointer
// at the end of the file.
$log = fopen('outlog.txt',a);
fwrite($log,"\n$url @ $date");
fclose($log);

header("Location:$url");
?>Although you may want to control whether you let your visitors read that file.