954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Javascript that Counts clicks

Hi,

I've got a page that I would like to count how many times a each button or hyper-link was clicked,

Basically it's what "google in-page analytics" dos'nt succeed to do in my site.

1. Is there a script that does it?

2. What is the best way to store the results?

3. How can I sort by date.

Thanks.

motiofel
Newbie Poster
12 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Could you not do something similar to when a user clicks the page an alert pops up.

replace the code where the popup occurs and just +1 to a counter.

If you wanted to store this data i spose there are 2 ways, one count all the clicks then when a user navigates away from the page make a call to the server to store the count into a database.

Or

Perform an ajax call each time a user clicks something, could be very heavy on your server though.

example code would be something like this i assume

$('#link_id').click(function(){
count = count + 1;
});

benjaminFowl87
Junior Poster in Training
74 posts since Aug 2010
Reputation Points: 17
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: