Geo Location
Overview
You can include geolocation information in transactions using the X-Geo-Location header in JSON format. By default, we determine location from the client’s IP address using MaxMind GeoIP. If you provide this header with valid data, it will be used instead of IP-based lookup.
Header structure
Pass a JSON object with the following fields:
| Field | Type | Description |
|---|---|---|
lat | number | Latitude coordinate |
lng | number | Longitude coordinate |
country | string | Country name or code |
city | string | City name |
ip | string | (Optional) Client IP address. If omitted, we use the request’s IP |
Example
{ "lat": 42.3601, "lng": -71.0589, "country": "US", "city": "Boston"}Behavior
- If the header is present and contains valid JSON, the provided geo data is used
- If the header is missing or contains invalid JSON, we fall back to IP-based geolocation
- If
ipis not provided in the header, the client’s request IP is automatically added