Amit Dhamu

Software Engineer

Client Location From Google

When using the Google API, data about from the Client is automatically sent to Google. This information includes latitude, longtitude, city and location. You can access this data if you have a Google API Key which you can obtain for free.

Firstly, create a JavaScript code block to load the Google API.

<script type="text/javascript" src=""></script>

Then to access the data, create a new JavaScript code block and do the following.

if (google.loader.ClientLocation) {
    var latitude = google.loader.ClientLocation.latitude;
    var longtitude = google.loader.ClientLocation.longitude;
    var city =;
    var region = google.loader.ClientLocation.address.region;
    var country =;
    var countrycode = google.loader.ClientLocation.address.country_code;
} else {
    // ClientLocation not found or not populated
    // so perform error handling


 google / client location / latitude / longtitude

Clean URLsTarget Nth Child in CSS

Show Comments

Made with by Amit Dhamu.
© MMXX. All rights reserved.