Counting clicks in directories

Discussion in 'Directories' started by mdalan, Oct 6, 2006.

  1. #1
    Hi,

    I see a lot of directories that offer to sort listings by popularity or by number of clicks. How can they know the number of clicks? I looked at the page source and the links are straight static links, no Javascript -- so how can they find out when a visitor clicks on a listing?

    Am I missing anything obvious?
     
    mdalan, Oct 6, 2006 IP
  2. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #2
    Yes. Like, what script(s) are you talking about?

    phpLD uses javascript to increment.
     
    an0n, Oct 6, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The links probably have a javascript onclick event to report click through rates.
     
    mad4, Oct 6, 2006 IP
  4. Lexiseek

    Lexiseek Banned

    Messages:
    2,499
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can't count clicks with a "straight-through" link. Maybe they're using J/S, but I'd still examine the code for funny business.
     
    Lexiseek, Oct 6, 2006 IP
  5. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can count the clicks with a straight through link. Thats how google counts clicks on the serps.
     
    mad4, Oct 6, 2006 IP
  6. mdalan

    mdalan Active Member

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    OK, so without either a redirecting link or onclick handler, you can't count clicks.

    http://www.deeplylinked.com/computers/hardware/ claims to count clicks (though perhaps it counts clicks on details page).

    The hardware page on CuteWebDirectory (just an example) and many others can sort by "Hits" or "Popularity". I see a straight-through link with no onclick handler. So what are they talking about?

    mad4, care to elaborate?
     
    mdalan, Oct 6, 2006 IP
  7. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #7
    phpld does have an onclick handler and so does deeplylinked.
    look for the AJAX in the code
     
    an0n, Oct 6, 2006 IP
  8. Lexiseek

    Lexiseek Banned

    Messages:
    2,499
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yeah, good luck with counting clicks on a "straight-through link".

    The directory you're talking about shows 0 clicks for most links placed there three weeks ago. Not even the spiders care :)
     
    Lexiseek, Oct 6, 2006 IP
  9. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Each link has an id for example id="523". There is then a script that uses getElementsByTagName and counts the number of time each element is clicked.

    <script>var root = '';
    	var a = document.getElementsByTagName("a");
    	for(i=0; i<a.length; i++)if(a[i].id != '')
    		a[i].onclick = count_link;
    	function count_link(){
    		i = new Image();
    		i.src= root+'/cl.php?id='+this.id;
    		return true;
    	}
    	</script>
    Code (markup):
     
    mad4, Oct 6, 2006 IP
  10. mdalan

    mdalan Active Member

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #10
    Ah, so the onclick handler is added dynamically after loading the document... I should have thought of that... Thanks!
     
    mdalan, Oct 6, 2006 IP
  11. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I wouldn't say its added dynamically. Its just that each link is given a name and the script tracks each link that way rather than using an onclick for each link.
     
    mad4, Oct 6, 2006 IP
  12. mdalan

    mdalan Active Member

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #12
    I guess it's a matter of definitions, but

    a.onclick = count_link;

    was what I meant by added dynamically.
     
    mdalan, Oct 6, 2006 IP