Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hit counters 1

Status
Not open for further replies.

alexanderdring

Technical User
Dec 27, 2002
36
FR
Hi everyone,

Thanks for the help with my previous post. This is probably really simple, but does anyone know how to put a hit counter onto a page? Ultimately I'll need to put it into a Fireworks page but I'm guessing I'll just be able to copy across the HTML code.

Thanks!
 
Hi,

You will probably find a site that provides a counter suitable for you. Then you create an account with a few steps on that site. After that the site will give you a piece of code - which is normally just a link - to your counter. So there will be no code on your page and still you will have the counter working.

Search for free+hit+counter and see what you find.

Good luck,

Lillu

 
Hi mate,

You can't create an actual hit counter with HTML, there is no way to store and access the data between users.

You would need to use another language to do this, preferably a server-side one to get a half decent count.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
I made a fake counter for my site. It always reads "000000002". It was very easy to do.

If I want the real number, I can just look in my logs.

Always good for a laugh!

Cheers,


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Aside from EdwartinMartinIII obviously making fun of the counter concept, presenting a site with a counter is downright hokey. Site logs and reports are the best way to count visitors. Counters smell of un-professionalism.

The only situation where I would want to include a publicly-accessible counter is if I were to make a page with compromising photos of my ex-wife. The counter would let her know how many others have seen her half-naked, squeezing a soaking-wet long-hair persian cat between her thighs, and standing on a billiard table in a smokey bar.

ahhhh.... the good old days....

- - picklefish - -
 
Now see, I wouldn't even use a counter for that -- I'd just use the same graphic: a GIF of a counter reading "000000002". I mean, if I wanted to insult her. Otherwise, I'd put an artificial counter there that had a ridiculously large number: "855756387" and tell her how thrilled I am to be hosting such a popular page!

Counters as an object serve only to demonstrate to visitors how popular the site is. They are at best self-indulgent.

However...

The very nature of home pages is supreme and glorious self-indulgence. Most every pro ISP out there already has some form of counter CGI script. So, Alexander, check your ISP's FAQ/scripts support pages. I'll bet they already have something for ya!

Cheers,


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
a simple PHP counter :)

this goes on the page with the counter:

<?php
//open file for reading
$file = fopen ( &quot;count.txt&quot;, &quot;r+&quot; );
$val = fgets ($file);
$val++;
fclose($file);

//open file for writing
$file = fopen ( &quot;count.txt&quot;, &quot;w+&quot; );
fwrite ($file, $val);
fclose($file);

echo &quot;Total visitors since 20-July-2003: $val&quot;;
?>

then u need to have the file count.txt in the same folder as your page with the counter and CHMOD it so that it is writable by anyone.

:)

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Thanks for the advice everyone!

I've been testing out the HTML counter, but I think the general concensus is that it looks a bit tacky so I guess I'll go for web statistics instead. And thanks for the tip jimoblak, I've no doubt that anyone looking for persian cats on Google will be soundly disappointed, just like everyone else not stuck in a porn loop.

Thanks again!

 
To further elaborate on what everyone else has said, and aside from them being extremely amatuerish, hit counters off absolutely meaningless information.

A &quot;hit&quot; is not the number of visitors to your page but rather the number if items that the server needs to upload to a browser in order to render the page. So, if you have 1000 thumbnail images (I must be out of my mind...) on your page then your counter is going to register each one as a &quot;hit&quot;.

Obviously, no one has this many images but it's not difficult to have 20, 30, and more, on a single page. So, unless you're willing to do the math, you'll never be abl to use a hit counter to measure your page popularity. Best to use the web statistics provided by your host - they'll be a lot more meaningful.

As an aside, I once saved a client over $1500 bucks with a coupon web site. The arrangement was payment by the number of people who clicked on the coupon on their site, which was a link to my clients site. They said that almost 50,000 people clicked on the coupon but the web logs indicated that for same time period only 9,000 users - total - came to the site.

There's always a better way. The fun is trying to find it!
 
How exactly was that &quot;hit&quot; counter programmed? I've never seen anything like that before. I've programmed &quot;hit&quot;counters for customers by request and it counts each time the page was requested, not how many images were downloaded...

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
- Quote by Douglas Adams
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top