Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15

Thread: click counter

  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    click counter

    i need a small and simple click counter that adds the data to a .txt file

    i looked on google and hot scripts but most of them are big scripts. Can someone help me and show me or send a link on how to make a small click counter script???

    Thanks
    services

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thats a hit counter not a click counter????
    services

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CATdude about IE6: "All your box-model are belong to us"

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Exactly what clicks do you want to measure with the click counter? If you want the flexibility to be able to measure clicks on anything on your site then that is potentially a big project, whereas if you only want to track clicks for downloads on a single page then that would be a lot more straightforward.

    Please try to provide as much information about what you want as possible.

  • #6
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just menu links so i can see if users are using the pages...
    services

  • #7
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mrruben5
    i already found that one on google it's the 4th one down in google when you type click counter.

    it's to big plus it's got a control panel i don't really need anything like that to fancy..
    Last edited by ChronicleX.com; 06-08-2005 at 12:16 PM.
    services

  • #8
    Regular Coder
    Join Date
    Apr 2004
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why not build your own, from what I am hearing nothing suites your needs so making one just sounds like a good idea.

  • #9
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by gsoft
    Why not build your own, from what I am hearing nothing suites your needs so making one just sounds like a good idea.
    That is what he asked for.

    I'd suggest that making your own hit counter would be better. It is better to use a hit counter for counting our own page loads as people could bookmark your pages, also it is a lot quicker as counting clicks probably requires you to redirect someone to the page they want after it has added the click to the file.
    Last edited by SeeIT Solutions; 06-08-2005 at 12:27 PM.

  • #10
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ChronicleX.com
    i need a small and simple click counter that adds the data to a .txt file

    i looked on google and hot scripts but most of them are big scripts. Can someone help me and show me or send a link on how to make a small click counter script???

    Thanks
    Quote my slef

    THANKS FOR YOUR HELP SO FAR
    services

  • #11
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can someone start me off please?
    services

  • #12
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well to implement SeeIT's individual page hit counter idea (which is defnitely better for these purposes than a click counter, after all you only want to see if a user visits a certain page, not count if he clicks back and forth 50 times while he's browsing) essentially all you need to do is register a session or set a cookie the first time the user visits and increment the count for that page in your file. If the session/cookie is already set then don't increment - it's really that simple.

    The advantage of cookies is that you can set a specified expiry time, eg a day and don't count any return clicks by that person on that day. The disadvantage of cookies... well, I think they're already well documented. Personally I'd go with the session solution.

  • #13
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so i should go with something like this???

    PHP Code:

    <?php 
    // 
    // Make a blank file called count.txt and CHMOD it 777 
    // 
    //Lets open the file as read only (r) 
    $fp fopen("count.txt","r"); 
    // The next line reads our file into a string, 
    // in other words sets the contents of count.txt as $count, 
    // so we can do stuff with it 
    $count fread ($fpfilesize ("count.txt")); 
    // We don't need more data from the file right now, so close it 
    fclose($fp); 
    // Now we need to increment the number in the file, using the ++ operator, +1 would work but this is nicer. 
    $count++; 
    // Now we've incremented the count, lets write it to the file 
    // We need to open if for writing (w) 
    $fp fopen("count.txt","w"); 
    // Now write the actual data 
    fwrite($fp$count); 
    // And close the file 
    fclose($fp); 
    // Lets display the updated count to the users 
    echo "Hits : $count"
    ?>
    services

  • #14
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well you could use that but bear in mind that it will create a separate file for each page you wanted to track and you would have to collate all the results from those files.

    Obviously you can automate this collation so it's not such a big issue but a better solution would be to use that code as a basis but modified to store all the page results in one file and then code a way to retrieve the data and increment the page counts within that one file.

    Of course, an even better solution would be to use a database to store the data since it will be much, much simpler to create and manipulate

  • #15
    Regular Coder
    Join Date
    Mar 2005
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks

    i will see what i can do with my php skills
    services


  •  

    Posting Permissions

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