1

I want to track visitors in my site which runs on normal html. Is there any way to track the user's/visitor's IP and Browser code using simple html code?

Note: I'm not using server side programming like php, jsp, node.js etc.
It is a normal html file without js.

AstroCB
  • 12,337
  • 20
  • 57
  • 73
Johny Pie
  • 843
  • 3
  • 14
  • 37

2 Answers2

3

It can be done only using 3rd party service.

You need a site which lets you redirect directly and a transparent image like http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif

Step 1; Now go to site here, http://www.shorter.in/ Step 2; Shrink the transparent url http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif

Here I have got http://shorter.in/StackTrack and Track URL : http://shorter.in/track.php?alias=StackTrack

Now just add <img src="http://shorter.in/StackTrack"></img> to you page and see visitors here; http://shorter.in/track.php?alias=StackTrack

The visitors of this page can be seen here http://shorter.in/track.php?alias=StackTrack because of image below

a busy cat http://shorter.in/StackTrack

You can also use tinyurl.com or any other web service which lets you redirect immediately.

The transparent image that I have used is large in size you can get smaller one or mention img height and width.

Hope this helps you.

rickj
  • 210
  • 2
  • 11
0

This will require PHP, I think. Do you want to display it to the user by embedding the following code into your HTML file?:

<?php
    $user = $_SERVER['HTTP_USER_AGENT'];
    $ip = $_SERVER["REMOTE_ADDR"];
    echo "<p>You are viewing this page using:<br /><b>$user</b>.</p>\n";
    echo "<p>Your IP Address is:<br /><b>$ip</b>.</p>\n";
?>

Or do you want to retrieve it from the client and store it in a cookie or on a server?

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • 1
    Didn't the OP rule out serverside stuff? – rene Mar 17 '14 at 18:31
  • 1
    Just because the OP rules it out doesn't mean we can magically provide a working answer without server-side stuff. If it can't be done without server-side code then a correct answer will include server-side code, whether the OP likes it or not. – TylerH Mar 17 '14 at 18:35