Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Macintosh JavaScript tracking code

    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.
    Code:
    <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.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,688
    Thanks
    80
    Thanked 4,650 Times in 4,612 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    jmurphy45 (05-21-2012)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •