homepage Welcome to WebmasterWorld Guest from 54.227.20.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
Forum Library, Charter, Moderators: Receptional & mademetop

Website Analytics - Tracking and Logging Forum

    
Web Logging & Cached pages
PHP versus JavaScript
ChrisXenon

10+ Year Member



 
Msg#: 4155 posted 9:01 am on Apr 13, 2006 (gmt 0)

I have a JavaScript web logging system which allows me to see each page as it is visited in sequence, but since it relies on JavaScript it does not see visits from:

1. Browsers which don't support JavaScript
2. Browsers with JavaScript disabled
3. Bots

- So I wrote a similar logging system using PHP and MySQL.

It captures all that missing traffic, but has an unexpected downside. When I compare the PHP logs to the JS logs, I see that the PHP logs miss out all repeated page visits from the same visitor.

I realised that this is probably because those pages are in the client browser's cache - and so no request to my server is made, and so no PHP log entry is made.

Is there a nice way around this?

Thanks for any light you can shed.

Chris

 

ChadSEO

5+ Year Member



 
Msg#: 4155 posted 1:53 pm on Apr 13, 2006 (gmt 0)

Chris,

There are a couple meta tags that can be useful it preventing client-side caching:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

These should prevent the browser from caching the page. While it's not foolproof, you should see an improvement in your numbers.

Chad

ChrisXenon

10+ Year Member



 
Msg#: 4155 posted 1:59 pm on Apr 13, 2006 (gmt 0)

Thanks for your repsonse Chad.

Presumably, the downside to this is that my visitors lose the benefits of caching and see a slower browsing experience, and my server sees more load and bandwidth.

Yeah, I know I want to have my cake and eat it, but you can't blame a guy for trying.

I'm also seeing that ocassionally my new PHP system fails to pick up the HTTP_REFERER - whereas the JavaScript version doesn't. Spooky.

ruserious

10+ Year Member



 
Msg#: 4155 posted 2:48 pm on Apr 15, 2006 (gmt 0)

> I'm also seeing that ocassionally my new PHP system
> fails to pick up the HTTP_REFERER - whereas the
> JavaScript version doesn't. Spooky.

Not all that spooky. It's probably some proxy that's filtering it from the HTTP-Requests, plenty of so called "privacy", "anti-spam", "anti-virus" programs like to do that kind of stuff. Since JS is executed directly in the browser, it does have access to the Referrer.

ChrisXenon

10+ Year Member



 
Msg#: 4155 posted 6:46 pm on Apr 15, 2006 (gmt 0)

Thanks for your expertise, ruserious, that makes perfect sense.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved