PDA

View Full Version : JavaScript tracking code



jmurphy45
05-21-2012, 02:28 AM
I am trying to make a code that will get various stats from the user when he or she visits my site like :
browser
computer
screen size
ip address
referrer
etc.

This is the code i have so far. I ma stuck on what i should do in the function.

<html>
<head>


</head>
<body>

<script type="test/javascript">
function stats (){
var data =

}
</script>

</body>
</html>
One more question will I need to use php to send it to my email of could javascript do this.

Old Pedant
05-21-2012, 07:43 AM
You can't get the ip address from JS code. Nor can you get the computer (if by that you mean the brand/cpu/etc.).

You can get referrer and user_agent (which tells you the kind of browser) and screen size. Yes, you will need to use PHP to send yourself the email.