How to find the most viewed article or most clicked link on my site?

Discussion in 'Programming' started by smart, Apr 24, 2008.

  1. #1
    Hi Guys,
    I have a collection of links, Now i want to know the most viewed or clicked link.
    Could you please help me finding the code or in writing the code?

    Thank you in Advance
    Smart
     
    smart, Apr 24, 2008 IP
  2. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    It all depends on how you log the users access to the pages. For example some CMS software increment the view count everytime a user reads a certain article, or just like a forum increments the views on a topic when it's read. Alot of time in such software it is stored in the database.

    Once you find where that information is stored (if it is stored) then we can probably help you more with how you can write the code.
     
    chopsticks, Apr 24, 2008 IP
  3. qprojects

    qprojects Peon

    Messages:
    1,901
    Likes Received:
    103
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Google Analytics can track link clicks i suppose (with some custom code)
     
    qprojects, Apr 24, 2008 IP
  4. smart

    smart Active Member

    Messages:
    232
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #4
    I have stored the URL's in a Database, Whenever a user clicks that count should increment. How can i do that?
     
    smart, Apr 27, 2008 IP
  5. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Use a simple SQL query such as:

    UPDATE site_links
    SET link_hits = link_hits + 1
    WHERE link_id = {insert link id here}
    LIMIT 1
    Code (markup):
     
    chopsticks, Apr 28, 2008 IP