Search by Visitor IP

It is remarkably simple to grab the IP address of a visitor, perform a visitor geolocation lookup, and then use that information to perform a normal proximity search.

# Visitor Geolocation

Before you can perform any visitor geolocation, you must have a geolocation service account.

With that in place, it's quite easy to get the visitor geolocation information.

{% set visitor = googleMaps.visitor %}

From there, it's simply a matter of using the visitor coordinates in your proximity search.

{# Get visitor info #}
{% set visitor = googleMaps.visitor %}

{# Proximity search based on visitor coordinates #}
{% set options = {
    'target': visitor.coords
} %}

Bypasses Google API

Conveniently, the Google API will not be pinged under these circumstances. When you use a set of coordinates as the proximity search target, no additional API call is necessary.