Jump to content

how to create a link counter?


BrainPill

Recommended Posts

Hello

I would like to create a script that counts the number of times a link is clicked on.

I think using the tag/attribute <a href=" "> is not useful as it is not possible to put an attribute like value='<?php echo $count ; ?>' in it.

Can it be done in php only or should I use javascript or jquery too?

Link to comment
Share on other sites

If you want to save the data on the server then you need to use PHP to save it.  If you want to count any arbitrary existing links then you could have Javascript send an ajax request to a PHP script with the URL that was clicked on, the URL of the current page, etc.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...