Forum Moderators: phranque
I don't think you'll be able to get away with putting a redirect on the page either. The problem is, any true 301 redirect is going to get executed before any of the page content gets delivered, even if it's located on the page itself.
So, you're stuck with doing some sort of Javascript redirect after the page has been displayed. This won't be a 301, and is the type of redirect that has been known go get Google to ban you.
I would switch to a host that provides log file access - that way you can see what happens.
Could I not put the javascript code first in the page followed by a php 301 redirect? Would that not work? (I know, straying a little bit off topic for this forum, but yours has been the best reply I've gotten so far).
The problem is that a 301 redirect will only work if there hasn't been any page content delivered to the browser. If you try to do a redirect after having delivered page content (including any Javascript), PHP displays an error message, and doesn't redirect the page.
I guess I'm not sure why you think a hosted web counter solution is better than reading your own logs. In terms of giving you information on where users are coming from and what pages they visit, you should be able to get that from your logs the same way you would from a JS page tracker.
Typically JS page counters are used when your web host can't or won't provide you with raw logs that include referer information. The other thing that they can do is provide some additional information, such as screen size and window size, that you won't find in a logfile. The will show you hits to your 301 redirected pages.
OK. we better end this OT thread now. Thanks for all your help.
If that's not enough for you, and you have access to PHP, why not use PHP to record who visited what? I wouldn't use Javascript for anything server-side. (Actually, I haven't used Javascript since the year 2000 because I loathed it so much.) With PHP you can record details to a database or, as a last resort, email the data to yourself. Then, so long as your script doesn't ouput anything to the user, I believe you can just let PHP initiate a 301 redirect.