SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A good counter script (custom tag or otherwise)

    Hey guys...

    I'm in need a good counter script. I'm building lots of these little sites for my company. Invariably, after I build them, my boss will come to me and ask me how many people have visited the site. I'm always left scrambling for some solution.

    So anyway, does anyone have a good Cold Fusion counter script? Ideally, it would count only unique visitors and write to a flat text file.

    Bueller?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  2. #2
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why not just check the logs? most hosts provide some sort of stats....

    or you could just roll your own. if you wanted to do it in a text file, you'd use cffile to read the current number, and then again to write the new one.

    <cflock name="counter" timeout="10">
    <cffile action="read" variable="count" file="yourfile.txt">

    <cfset count = count + 1>

    <cffile action="write" file="yourfile.txt" output="#count#">
    </cflock>

    cffile has some pricey overhead, and you'd need to use those locks to make sure you dont have any collisions. would be ok for a low traffic site, but not a high traffic one.

    it'd probably be faster to do it in a little DB...

    it was great seeing you at the conference, wish i coulda hung around after, but i didn't want to have to sleep somewhere exciting like....rochester

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but does either method you mentioned count unique visitors only?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, lets see....no and no!

    the only way to accurately do that is to drop a cookie on every visitor. but not every visitor will eat the cookie, there is no 100% accurate way to do it.

    i thought you said *ideally*. Ideally, all the traffic on the internet will visit and purchase things only on the sites i've built. then i wouldn't need no stinking counters.

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look man...

    Don't make me come to Conn and kick your butt. I know what you look like now. You can't hide from me.

    Did you look at my other thread? Maybe you could actually help me out for once instead of just being a smart-***.



    Did you make it back safely? Get arrested by any small town cops? Get "frisked"?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  6. #6
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hahaha

    well, i thought a 'full cavity search' required a trip to a dentist, boy was i ever wrong!

  7. #7
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  8. #8
    SitePoint Addict -TheDarkEye-'s Avatar
    Join Date
    Mar 2001
    Location
    canada
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cf has a built-in hit counter. just use that. just make sure you tell cf to store all its client vars in a db and not the system registry.

  9. #9
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the syntax for that? I've never read anything about it in my CF book.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  10. #10
    SitePoint Addict -TheDarkEye-'s Avatar
    Join Date
    Mar 2001
    Location
    canada
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you happen to have access to the coldfusion documentation (im looking at a cf5 version) i can help you here.

    Developing ColdFusion Applications -> Using the Application Framework -> Configuring and Using Client Variables

    its all there.

  11. #11
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


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
  •