Nik has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!,
I was wondering how can i make my webpage http://www.nikolas.tk realize that it must not add the counter when i especially visit it!
I need to do that without using the cookie method!
Thanks all!

Replies are listed 'Best First'.
•Re: webpage that can identify its maker!
by merlyn (Sage) on Feb 28, 2004 at 23:04 UTC
      Nik can possibly use DynDNS for his home machine, so he doesn't need a constant IP?
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: webpage that can identify its maker!
by Anonymous Monk on Feb 29, 2004 at 05:21 UTC

    A couple of options spring to mind:

    • Dump the counter. Who uses counters nowadays?!
    • Leave it as it is. Incrementing your visits makes it look like you have more visitors. That's what counters are about isn't it? Overexagerating your visitor count?
    • Don't visit your own site and you won't affect the count. Simple as that.
    • Use a browser that allows you to set a manual useragent and set it to something that you set the scripts to recognize and ignore counting any hits with said useragent. If such a browser does not exist, make it yourself.
    • Ignore my (mostly) jokes and use the cookies or IP methods.
      • Dump the counter. Who uses counters nowadays?!
      • Don't visit your own site and you won't affect the count...

      When I first read this thread I remembered back almost ten years (1994) ... the last time I used a web counter. I had created a page that detailed how to overclock i486 CPU's. The page enjoyed relative popularity for its day. I installed the (then obligatory) vanity-counter, and watched its hits climb to over 150,000 in about a year's time.

      At one point I thought...hmm, I'm skewing the number by periodically visiting the site to confirm site maintenance. But I quickly dismissed that thought, realizing that even if I hit the site 300 times, I was only skewing the hit counter by 0.2% (two tenths of a percent).

      That was ten years ago, at a time when the number of internet users with web access was a drop in the bucket compared with today. Reality, practicality, and the proliferation of counter-skewing mechanised web-crawlers have all contributed to the virtual disappearance of web-counters from most websites (except those of the script-kiddies).

      Given the fact that mechanized crawlers must generate a magnitude more hits on a popular page than the page's author possibly could (unless he had no life, or a mechanized page-hitter of his own), the few hits a developer might add to his counter have got to be insignificant compared to the counter hits contributed by all the other many sources out there. If, ten years ago, I was able to shrug off a few hits generated in the course of my page development, now, in 2004, one would have to be operating a pretty unpopular page to even have to think of the potential of his own hits skewing a total number.

      If site popularity is an important thing to measure, get users to log in, and keep track of all sorts of related stats that way. Or set cookies and track them... that's one of the most common uses of cookies nowadays. But unless you don't mind that it's made inaccurate by web crawlers and other sources beyond your control, abandon the counter. It screams amature.


      Dave

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: webpage that can identify its maker!
by atcroft (Abbot) on Feb 29, 2004 at 01:23 UTC

    This is just a thought, but could you not set a cookie via a page that is known only to you, then have your counter check for the presence of the cookie, and only increment if it isn't set? In this way, it would not matter if your IP changed, as long as your browser returned the cookie.

Re: webpage that can identify its maker!
by fraktalisman (Hermit) on Feb 29, 2004 at 12:47 UTC
    There's some information about the browser that you can usually find in the server's variable $ENV{'HTTP_USER_AGENT'}
    In my case that is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", but I've seen other signatures in my logfiles. With the opera browser, it's possible to write a user agent yourself in the browser's preferences. Maybe this is even possible for internet explorer. So you could maybe add _nikolas.tk_ at the end, then your script can look for that signature. You should not erase the Mozilla/4.0 part or otherwise you might get problems when other websites think you're using an outdated browser.

    Anyway, I think like others already said, best you just kick the counter out! Best way to really count visitors on a web site is to analyse the server logs (with a system like webalizer or with a custom script) so you can count out the search engines as well.
    BTW if you want to make some other improvement to the site, why not add an English version?
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: webpage that can identify its maker!
by exussum0 (Vicar) on Feb 29, 2004 at 01:14 UTC
    Why can't you do it with cookies? If it's a perl problem, you can use JS for cookie detection, and document.writeln the counter.cgi loader if it's done via an image..

    Just a thought.

    I used to be a funny character, now I'm just 4 bits.

Re: webpage that can identify its maker!
by Jenda (Abbot) on Feb 29, 2004 at 23:29 UTC

    You need to be sending something special to the server in order for it to know it's you. If it can't be cookies, then let's use something else. Like eg. Accepted Languages.

    You browser most probably allows you to set the accepted languages. In Internet Explorer it's under Tools\Internet Options\General, click the {Languages} button. You can add your own "bogus" user-defined language and then in the script test whether $ENV{HTTP_ACCEPT_LANGUAGE} contains that string.

    A bit dirty, but works.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: webpage that can identify its maker!
by crabbdean (Pilgrim) on Feb 29, 2004 at 18:13 UTC
    One of my initial thoughts was that if you use a script on the page for parsing the URL address, pass it a extra variable so that when it parses it, it realises it's you. Just use something obscure as the extra variable.

    Dean

    Programming these days takes more than a lone avenger with a compiler. - sam