I need a way to count how many times a link is being clicked and I was thinking of creating a php script to redirect to and do the counting. Is there a better way to do this and how would i count each time the user visits the link and would it be best to save in the database somewhere…any suggestions
Share
Yes, it must be a PHP script – JavaScript for example won’t work all the time.
So – instead of a link to
You would link to
And in the redirect.php you will track, for example, in a database, the values, and in the end throw this header:
To redirect to the path after ?…
// yeah – logs might work… a little bit more work, though and it is also very server specific.