Geolocation

Geolocation provides the location of a visitor on a city level. Geolocation is based on IP address of the visit.

await fp.get()
// Webhook and Server API data will contain this information:
{
  "ip": "89.112.151.14",
  "ipLocation": {
    "accuracyRadius": 5, // The radius in kilometers around the specified location where the IP address is likely to be.
    "latitude": 37.987,
    "longitude": -1.13,
    "postalCode": "30006",
    "timezone": "Europe/Madrid",
    "city": {
      "name": "Murcia"
    },
    "continent": {
      "code": "EU",
      "name": "Europe"
    },
    "country": {
      "code": "ES",
      "name": "Spain"
    },
    "subdivisions": [
      {
        "isoCode": "MC",
        "name": "Murcia"
      },
      {
        "isoCode": "MU",
        "name": "Murcia"
      }
    ]
  },
  // ...
}

In order to receive the geolocation information in the object returned by a JS agent, add the extendedResult: true option.

const result = await fp.get({
  extendedResult: true
})
console.log(result);
// Prints the following:
{
  "ip": "89.112.151.14",
  "ipLocation": {
    // ...
  },
  // ...
}

What’s Next