View Full Version : JavaScript tracking code

05-21-2012, 01: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 :
screen size
ip address

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



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


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, 06: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.