If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

If you wrote your html and css properly you wouldn't need to worry about the client's screen dimensions. What are you going to do for people with javascript disabled.

If you'll excuse me saying, I'm a web designer and I think I know how to write CSS and (X)HTML. As Mindzai correctly pointed out, I am writing an analytics package for distribution (free) and, although this is not something I require, Screen Resolution is something logged by Google Analytics, the most well-known free package. Many people may take this into account when considering using my software.

For people without javascript, the main script runs in php, so that will pick most things up. Please do not flame, it is considered offensive on forums. The iframe was a temporary method of implementing javascript.

To connect javascript and PHP, it is necessary either to set cookies or to compose a url using javascript. Both require a page reload for PHP to interpret them. This messes up detection of the referrer in PHP, so I used an iframe.

I repeat on sending a url of a PHP script for the image, how do I get it do display the image?

To connect javascript and PHP, it is necessary either to set cookies or to compose a url using javascript. Both require a page reload for PHP to interpret them. This messes up detection of the referrer in PHP, so I used an iframe.

This is not correct. As Ive said a few times in this thread now, the right way to do this is to send a post request via AJAX. This doesn't require composing a url with javascript, setting cookies or reloading any pages.

if you really want to use an image (which I would consider a "bodge job" as we say in the UK), you'd have to set the appropriate HTTP header withthe header() function, and then output the image file to the browser.

if you really want to use an image (which I would consider a "bodge job" as we say in the UK), you'd have to set the appropriate HTTP header withthe header() function, and then output the image file to the browser.

Yes - I'm UK too. I am aware of this being a "bodge" job.

Thanks for the Ajax solution. How exactly would I do this? I'm not an Ajax guy!

could you please explain the stats_capture.js line by line, so I know where to add new logging stuff?

Any extra items just add to the stats_capture function. Also don't forget half the stuff you may want to log is available through the http headers so your logging script could capture them from the ajax request.

Originally Posted by Ronnie268

Also, has anyone any ideas how to make a PHP fall-back for if JS is disabled? This would enable bot logging.

Depends what you want to log. For example bots don't have screen width and height as they don't have screens.

The third function (input phase) collects the data and sends it to the first function for transmission to the server. When there is a response from the server (response phase) that response is return to the third function (by the second function). In the PHP response script (line 12) php is telling the javascrit which function to return the response to as there may be more than one javascript function that possesses the responses.

In this example I've just used one variable which contains both the screen width and height delimited by a comma. If you choose you could send a whole string of variables and process them as you wish in PHP.

What does processReqchange do? Is it needed if you don't want to send a response?

Ronnie, it's like this, you just want your code to do this one job, but when I wrote that code I tried to make it as reusable as possible so that when someone else comes along who wants to have background communication with the server for another reason they will already be able find 75% of the code they need.