Geolocation for displayed listings on home page

Hi. I have a “listings” block on my home page.

Is there a way to modify that so the displayed listings show listings near the visitor’s location? IP address is the obvious solution. Is that possible? or is there another way to customize displayed listings based on location of the visitor so the featured listings are more useful?

I’m open to all solutions and best practices.

Thank you.

1 Like

Hello,

It really depends on the GIS (map) provider you are using.

I am a big fan of leaflet.js, where you can use map.locate().

For privacy reasons, this will work only if you did allow your device (laptop, smartphone) to do so.

Here’s the related documentation and a personal working example.

Click this icon in the map to see it in action:

image

Thanks for the quick reply. If we’re using google maps, is there a way to do it?

Probably.
Use Google to find out.

2 Likes

Thanks.

we might be talking about different things. I’m talking about the below section on the home page displaying listings based on gelocation data of the website visitor. it wouldn’t be on a map.

when clicking on the block “settings”, there is no option to sort or display based on geolocation of the website visitor. there are options like “service offered”, “category”, etc.

I am not sure this is possible.
SEO-wise, I would advise against it anyway, as Googlebot won’t be able to index content due to this hack.

Got it. appreciate the input.

Hi,

In the current version, this would require a custom implementation since browsers don’t share the location without consent (guessing by IP may not be accurate). So implementing a custom prompt asking to share or select the current location would be needed, with further filtering the listings. Currently, the same result is possible but with 1 extra step (clicking the Locate Me icon in the search bar and then search), we’ll also try to simplify this in future updates.

1 Like