Forum Moderators: phranque

Message Too Old, No Replies

Tracking user's screen resolution

Best free method / script

         

silverbytes

5:59 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As far as I know log files doesn't contain info about screen resolutions. I want to detect if my users have 1024 or other resolutions. Someone mentioned using a jscript or similar.

May someone comment about what free and if possible effective method use to track user's screen resolution? any good experiences you wanna share?

Thank you!

bcolflesh

6:03 pm on Jun 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Javascript is the easiest way to get it - here's a sample with some PHP to interact w/the info:

[phpbuddy.com...]

silverbytes

12:11 am on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks. That script tells you the user resolution.
I want to find out that data and be able to count how many of my users have each resolution. It would be great if that data could be added to the raw log file or in any page to take a look and compare the chart along the time.

The script was.


<HTML>
<TITLE>Whatever</TITLE>
<HEAD>
<?
if(isset($HTTP_COOKIE_VARS["users_resolution"]))
$screen_res = $HTTP_COOKIE_VARS["users_resolution"];
else //means cookie is not found set it using Javascript
{
?>
<script language="javascript">
<!--
writeCookie();

function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie

location = 'get_resolution.php';
}
//-->
</script>
<?
}
?>
</HEAD>
<BODY>
<?php
echo "Your Screen resolution is set at ". $screen_res;
?>
</BODY>
</HTML>

Does someone know how to keep track of that?
Something like

1024*768 users = 500
800*600 users = 300
bla bla

Or percentages or graphic charts...