PDA

View Full Version : Use of StatCounter on custom error pages, eg 404


ShadyCraig
12-24-2004, 11:47 AM
I recently put a custom error page on my site for 403 and 404 errors (I use the same error page for both), I tried this out by repeatedly requesting a missing file.
Odly enough the hits show up in 'popular pages' as the URL of the missing page, not the 404 error page. So if loads of people request many different deleted pages then they might not make the 'popular pages' list.
What would be ideal is if the page showed up as the 404 page, but showing the missing page as the referer.
To be honest this is the way I expected it to work.

Am I doing something wrong?

Merry Christmas everyone!

webado
12-24-2004, 01:29 PM
I don't think you're doing anything wrong in particular. The server handles it this way. If you notice, the url of the missing page is what is displayed in the address bar while the 404.html page is actually being shown.

I think you'll find that to accomplish what you want you'll have to use a meta refresh tag (refresh time of 0) on the 404.html page itself and redirect to a different collector 404 page (call it something like my-404.html) where you place the counter. Then it's my-404.html page which will show up in your stats instead of the official 404.html page.

You may want to have the counter on both the official 404.html and the collector page, this way you will know what page was being requested and by whom.

ShadyCraig
12-24-2004, 03:03 PM
Hi Christina,

Yes you are absolutly right! When the 404.html page is shown, the URL in the address bar is the missing file location...

Redirecting as you suggest would seem to resolve the problem of counting those page hits, but what would the refer be? The missing file URL or 404.html?
I think I'll have to try it to find out! :idea:

webado
12-24-2004, 03:49 PM
Hi Christina,

Yes you are absolutly right! When the 404.html page is shown, the URL in the address bar is the missing file location...

Redirecting as you suggest would seem to resolve the problem of counting those page hits, but what would the refer be? The missing file URL or 404.html?
I think I'll have to try it to find out! :idea:
I put the counter on the standard 404.html page as well as on the collector 404 page. The collector page has no referrer. It may have the same referrer as the 404.html page, but when I tested, I entered directly the url to a non-existent page so there was no referrer anyway.

Just tested it with a link to a non-existent page from another test page, but as luck has it, Statcounter reporting is lagging right now so I can't see the effect yet :roll:

ShadyCraig
12-29-2004, 09:05 AM
Just tried this on my own server.
At first I made that same mistake of typing the url direct of course this didn't work, but I deliberately put an incorrect link on a test page and this also didn't report any referrer.
I'm wondering is there is some setting to correct this. Maybe referrer forwarding or something? I'm just speculating.
Other than I don't know of a better solution than simply placing the statcounter code on the standard error page.