Geolocation Detection πŸ§ͺ

Route Visitors and Display Conditional Elements Based on Country or City.

UNDER DEVELOPMENT Watch this space.

Use Cases

  • Route visitors to a Country-specific home page

  • Route visitors to a City-specific contact-us page

Feature Roadmap

  • Route user by Country

  • Routing table support

    • Supports routing any defined path, e.g. /about to any Geo-specific variants you have, e.g. /about/gb, /about/au, /jp/about.

    • Routed sources and destinations are unlimited, no enforced path rules.

  • Standardized GeoInfo object, to consistently describe the detection regardless of the GeoIP handler source

  • Cached responses, for minimal GeoIP service traffic

    • One request per unique user

GeoIP handlers;

  • IPInfo support. 50,000 requests/mo free.

Usage Notes

Routing Rules

Routing rules are configured just before the library is loaded in the script section indicated with // Routing rules ( see quick start ).

  • You may have multiple rule configurations in this section, though this is mostly a future design facilitation. Most likely, the first rule matched will be applied.

Route by Country

Specify the rule type as geo-country.

Supply your routes, from country code to path, exactly as in the structure below. You may have as few or as many routes as you like.

If the visitor's country is not in the list, they will not be routed. They will simply match the default page.

We're working on a design for grouped countries as a regional definition.

<script>
// Routing rules
window['sa5_route'] = [{
    type: 'geo-country',
    path: '/',
    route: [
        ["NZ", "/nz"],
        ["AU", "/au"],
        ["US", "/us"],
        ["GB", "/gb"],
    ]
}];
</script>

Last updated