On this page

IP address, location, user agent, and device properties

Data that highlights user location properties, such as a user's city and country, is crucial for generating insights about the geographical distribution of your users. Location data can show you how user preferences and behaviors differ from region to region and help you better optimize your product. Similarly, device and platform information helps you understand which devices and operating systems your users use.

How Amplitude tracks location properties

Amplitude uses the MaxMind database to look up location information from the user's IP address. Even though MaxMind data is reliable, the accuracy and availability of city and region information can vary by country.

By default, Amplitude uses GeoIP to gather location property values based on location_lat and location_long. You can explicitly define how Amplitude tracks a user's location properties server-side. Amplitude's HTTP API lets you send your own [Amplitude] City, [Amplitude] DMA, [Amplitude] Region, and [Amplitude] Country values with your events.

If you send these values, Amplitude doesn't modify them to reflect GeoIP. Always update all four fields together, because setting any one of the fields resets the others.

How Amplitude determines location properties when IP address is unavailable

Amplitude supports both disabling IP address tracking in the SDK configuration and dropping IP addresses after ingestion. The method you choose affects how Amplitude can determine location properties.

Disable IP address tracking in the SDK

When you disable IP address tracking in the SDK configuration (for example, Browser SDK, Android-Kotlin SDK, iOS Swift SDK), Amplitude never receives the IP address. Amplitude's back-end services can't reconcile the user's location, and any location properties remain empty.

IP address filtering

If you request Amplitude Support to drop IP addresses after ingestion, Amplitude's back-end services process the IP address to determine location, but the IP address itself doesn't persist in Amplitude. Location properties on an event are filled, but the IP address remains empty.

How Amplitude parses user agent and device information

Amplitude automatically parses the user agent string from client-side SDKs to extract device and platform information. Amplitude adds this information to your events as properties, letting you segment and analyze user behavior across different devices and platforms.

User agent parsing

When client-side SDKs (for example, Browser, iOS, Android) send events, Amplitude automatically captures and parses the user agent string to find:

  1. Device model: the specific device model (for example, iPhone 13, Samsung Galaxy S21).
  2. Operating system: the OS and its version (for example, iOS 15.4, Android 12).
  3. Browser: for web traffic, the browser and its version (for example, Chrome 98.0.4758.102).
  4. Platform: the general platform category (for example, iOS, Android, Web).
  5. Manufacturer: the device manufacturer (for example, Apple, Samsung).

Device properties

Amplitude automatically adds the following device-related properties to events:

How user agent parsing works

  1. Client-side collection: the SDK automatically collects the user agent string from the client device.
  2. Server-side parsing: when Amplitude receives the event through the HTTP V2 API or other ingestion paths, Amplitude parses the user agent string using a combination of regular expressions and user agent parsing libraries. If os_name, os_version, or device_model appear on the request, then those values appear on the final event. If not provided, Amplitude parses the user_agent field to set those values on the event. Fields such as device_family and device_type come from a combination of device_brand, device_manufacturer, and device_model. device_manufacturer and device_brand are expected to be top-level fields on the event, but can be null.
  3. Property assignment: Amplitude adds the parsed information to the event as properties.
  4. Analysis availability: these properties are then available for segmentation, filtering, and analysis in Amplitude.

Controlling device property tracking

To disable automatic tracking of certain device properties, use the trackingOptions configuration in the SDK. For example, in the Browser SDK:

javascript
amplitude.init(AMPLITUDE_API_KEY, {
  trackingOptions: {
    platform: false,
    language: false
  }
});

Mobile-specific device information

For mobile SDKs (iOS, Android), Amplitude collects additional device information:

  1. iOS: device model, OS version, and carrier information when available.
  2. Android: device model, manufacturer, OS version, carrier, and screen dimensions.

This information can help you understand how your app performs across different device types and OS versions.

Custom device properties

If you need to track additional device information that Amplitude doesn't automatically capture, you can add custom properties to your events:

javascript
// Example of adding custom device properties
amplitude.track('Button Clicked', {
  'screen_resolution': '1920x1080',
  'connection_type': 'wifi',
  'battery_level': 85
});

Was this helpful?