Jump to content
Sign in to follow this  
BrainPill

how to create a link counter?

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...