Google Geolocation Api to track users Location - COuntry, City, State, Timezone

467 Views Asked by At

Does google offer geo location ip services like freegeoip, maxmind etc which can offer me the users exact ( need almost accurate like how gooogle offers) location, Country - State - City, Timezone, Brower used Mobile or PC

2

There are 2 best solutions below

0
On

Google offers it as service of HTML5 in web browsers. You will need to have users permission to retrieve their geolocation information. The web browser will prompt for permission.

0
On

If you need the best accuracy for mobile users you should use the navigator geolocation API (see https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) and enable high accuracy to get the exact GPS position.

A good practice if your app can benefit from a less accurate location instead of no location at all is to fall back to an external IP geolocation API when the user denies location access : https://db-ip.com/api/jsdoc.php#browsergeo