By using just simple PHP or Javascript programs it is possible to extract basic information from website visitors.
For example, by adding the following PHP code in a web page we can extract the IP, Operating System, Browser type, and HTTP Referer:
<?php
echo “Your remote address: “;
echo $_SERVER[“REMOTE_ADDR”];
echo “Your browser, operating system, language settings: “;
echo $_SERVER[“HTTP_USER_AGENT”];
If ($_SERVER[‘HTTP_REFERER’]==””)
echo “coming directly to this webpage”;
else echo “Coming to this page from: “.$_SERVER[‘HTTP_REFERER’];
?>
Using the IP address we can deduce, country, city, and sometimes from which organization the visitors are coming from, e.g. University XX. Tools such as the Unix commands whois, host, nslookup are useful. Additionally, several websites offer geocoding services. Use a Google search to find them out.
With some Javascript code we can visualize the screen resolution, color depth, Java support of visitors landing to a webpage. Eventually, we can offer them a better web page layout according to these parameters.
<p align=”left”>
<SCRIPT LANGUAGE=”JavaScript”>
document.write(“screen resolution: “)
document.write(screen.width + “x” + screen.height+”, “)
document.write(“Color Depth: “+screen.colorDepth+ “, “)
document.write(“Java Enabled: “+ navigator.javaEnabled())
</script>
</p>
And we can also learn whether they came to our webpage using a search engine and which keywords they used . The following script provides an example, copy&paste it to your home page: extract search engine keywords
Useful sources of info are Google webmaster blog and Matt Cutts blog