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:
- Device model: the specific device model (for example,
iPhone 13,Samsung Galaxy S21). - Operating system: the OS and its version (for example,
iOS 15.4,Android 12). - Browser: for web traffic, the browser and its version (for example,
Chrome 98.0.4758.102). - Platform: the general platform category (for example,
iOS,Android,Web). - Manufacturer: the device manufacturer (for example,
Apple,Samsung).
Device properties
Amplitude automatically adds the following device-related properties to events:
| Property | Description | Example Values |
|---|---|---|
device_brand | The manufacturer of the device. | "Apple", "Samsung", "Google" |
device_manufacturer | Like device_brand, but may contain more specific information. | "Apple Inc.", "Samsung Electronics" |
device_model | The specific model of the device. | "iPhone13,2", "SM-G998U" |
device_type | The type of device. | "iPhone", "Android" |
os_name | The name of the operating system. | "iOS", "Android", "Windows" |
os_version | The version of the operating system. | "15.4", "12.0", "11" |
platform | The platform category. | "iOS", "Android", "Web" |
browser | For web traffic, the browser used. | "Chrome", "Safari", "Firefox" |
browser_version | For web traffic, the browser version. | "98.0.4758.102", "15.3" |
How user agent parsing works
- Client-side collection: the SDK automatically collects the user agent string from the client device.
- 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, ordevice_modelappear on the request, then those values appear on the final event. If not provided, Amplitude parses theuser_agentfield to set those values on the event. Fields such asdevice_familyanddevice_typecome from a combination ofdevice_brand,device_manufacturer, anddevice_model.device_manufactureranddevice_brandare expected to be top-level fields on the event, but can be null. - Property assignment: Amplitude adds the parsed information to the event as properties.
- 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:
amplitude.init(AMPLITUDE_API_KEY, {
trackingOptions: {
platform: false,
language: false
}
});
Mobile-specific device information
For mobile SDKs (iOS, Android), Amplitude collects additional device information:
- iOS: device model, OS version, and carrier information when available.
- 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:
// Example of adding custom device properties
amplitude.track('Button Clicked', {
'screen_resolution': '1920x1080',
'connection_type': 'wifi',
'battery_level': 85
});
Was this helpful?