Since you want to know the location of the person viewing your website, the data will be taken from the client machine.
Use
navigator.geolocation.getCurrentPosition(showPosition);
for getting the client's location. The showPosition is a function name to be passed, so define a function with this name. If you just want to show the location only on client machine, do as follows:
function showPosition(position) {
var x = document.getElementById("demo");
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
Or you can send data to your server too.
You can get a little more information about this at https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
Now you have the coordinates ( find out, how accurate? ), use google map location services api to get the location name.
The Google Maps Geolocation API - https://developers.google.com/maps/documentation/geolocation/intro