SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Usability: Keeping Tabs On What Does and Dosn't Work

    SitePont Memebers,
    Is there any sort of coding where when someone clicks on a link, the visitors is taken to the link but also each time the link is clicked each click is counted and the count is kept on my site in some way? I'd rather not use a monitoring service.

    Thanks,

    Linda

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,087
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Lindaro View Post
    SitePont Memebers,
    Is there any sort of coding where when someone clicks on a link, the visitors is taken to the link but also each time the link is clicked each click is counted and the count is kept on my site in some way? I'd rather not use a monitoring service.

    Thanks,

    Linda
    Create the link to a serverside script which records the url (e.g. write it to a database), and then redirect to that url.

    /redirect.php?url=/somelink

    of course php is just an example

    Why don't you use some statistics software like AwStats btw? They parse the access logs of your web server. A much more neat way to handle your problem imho.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Scallio,
    The link is to another website that is not my website, if that helps. I have awstats on my Bluehost webhost account; I can't place it on my site and choose my own settings.

    Can you help me with

    "Create the link to a serverside script which records the url (e.g. write it to a database), and then redirect to that url. /redirect.php?url=/somelink"

    Is this something I can do with the .htaccess file?


    Thanks,

    Linda

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lindaro View Post
    "Create the link to a serverside script which records the url (e.g. write it to a database), and then redirect to that url. /redirect.php?url=/somelink"

    Is this something I can do with the .htaccess file?
    Well, in theory, yes, but then you would lose the ability to count clicks, so there'd not be much point.

    The idea is something like this: Instead of
    Code HTML4Strict:
    <a href="http://example.com">example</a>
    you'd use
    Code HTML4Strict:
    <a href="/redirect.php?url=http%3A//example.com">example</a>

    Then, in your redirect.php script, you'd do something like this,
    1. Log the click for the requested URL, e.g., in a database.
    2. Redirect to that URL.


    So you'll need to do some server-side programming for this.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •