Skip to content
Gurdx

Docs / Use-case guides

Web personalization

Use the visitor's IP to tailor language, currency, content and compliance behaviour without asking them questions.

The problem#

Showing a visitor the wrong language, currency or legal notice causes friction. Asking them to pick every time hurts conversion. IP geolocation gives a good first guess that you can refine.

Signals to combine#

  • IP geolocation: country, region, city, timezone, currency and language of the visitor.
  • Country lookup: details such as currency and calling code for a country you already know.
  • IP lookup when you also want to know about proxies, so you do not personalise for a VPN exit node.
  • Free IP lookup to read the visitor's own IP address.

Integration flow#

  1. On the first request of a session, read the visitor's IP on your server (mind your proxy or CDN headers).
  2. Call geolocation once and cache the result in the session or a cookie for the visit.
  3. Choose defaults: language, currency, shipping options, store region, cookie banner and consent rules.
  4. Always let the visitor override the choice, and remember it.
  5. Skip personalisation when the IP is flagged as proxy or VPN, and fall back to the browser language.
// Express middleware
app.use(async (req, res, next) => {
  if (req.session.geo) return next();
  const ip = req.headers['x-forwarded-for']?.split(',')[0] ?? req.ip;
  try {
    const r = await fetch(`https://gurdx.cretip.com/api/geoip?ip=${ip}&lang=EN`, {
      headers: { Authorization: `Bearer ${process.env.GURDX_KEY}` },
      signal: AbortSignal.timeout(2000),
    });
    const body = await r.json();
    if (body.status === 'success') {
      req.session.geo = {
        country: body.data.countryCode,
        city: body.data.cityName,
        timezone: body.data.timezone?.name,
      };
    }
  } catch { /* personalise with defaults */ }
  next();
});

Tip: Use a short timeout and a sensible default. Personalisation must never delay or break the page.

Practical advice#

  • Cache by IP for a few hours to save requests, since one visit rarely moves country.
  • Use the country for defaults, not for blocking, unless a legal requirement applies. IP location is approximate and wrong for some mobile and corporate users.
  • Pass the lang parameter to get names in the visitor's language.
  • For regulated content such as cookie consent or age notices, treat the IP result as a hint and apply the stricter rule when unsure.

Related reference: IP geolocation. For security uses of the same data, see Account takeover.

Found a mistake? Tell us on the contact page. Contact