In web to lead, you can input any address that you want.I need to detect the exact location or just the state or city of the user who used the web to lead. Is this possible? any ideas how? Thanks in advance.

2 Answers 2


If your browsers support Geolocation you will be able to get this information by adding simple JavaScript to your web to Lead form, otherwise you can simply click on the below link

Here is the link from very popular Google services

The JavaScript would be as below

  window.onload = function() {
  var startPos;
  var geoSuccess = function(position) {
  startPos = position;
  document.getElementById('startLat').innerHTML = startPos.coords.latitude;
  document.getElementById('startLon').innerHTML = startPos.coords.longitude;

The other option is to fetch the public IP of user and from that IP figure out the location(approximate) of user.

Here is how you can find the users Public IP using javascript:

$.getJSON("http://jsonip.com?callback=?", function (data) {
    alert("Your ip: " + data.ip);


Then use a free open source community that translate IP into location. geolocation ip service one such service that runs on the MaxMind database is available here: http://freegeoip.net/



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .