5

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.

5

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;
 };
  navigator.geolocation.getCurrentPosition(geoSuccess);
};
3

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);
});

http://jsfiddle.net/lesson8/juJYJ/

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/

Ex:

http://freegeoip.net/json/74.125.225.231

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.