Product Locator: browser-based location detection

To provide the most accurate nearby results to shoppers, when a shopper loads their first product page on which you've installed the Locally Product Locator, the shopper will be asked to allow or deny the sharing of their location via their browser. If approved, Locally will load this location in the Product Locator and that location will persist across their shopping session. If denied, Locally defaults to using IP-address based geo-location.  If desired, your website can also access this result by using the browser location API. Contact for more information.

This feature can be disabled, in which case Locally will only use IP-address based geo-location. 

Accessing the user's location

You can check if the user has shared their location or not. If they have, you can call the browser api to fetch the coordinates.  

Use this code snippet to check if the user has shared their location:


If the user has shared their location, call the browser location api to fetch the coordinates. Here is a sample navigator function:  

navigator.geolocation.getCurrentPosition(function (position) {
      // do whatever you'd like with position.coords
    }, function (error) {
      //This is the handler if user does not allow location or already denied a location
    enableHighAccuracy: true

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.