IP address, location, user agent, and device properties
このページはまだあなたの言語に翻訳されていません。 現在取り組んでいますので、後でもう一度確認してください。
Amplitude derives a user's location, device, and platform properties from data that arrives with each event, rather than requiring you to set those properties yourself. It looks up city, region, and country from the event's IP address with the MaxMind GeoIP database, and parses the user agent string that client-side SDKs send to determine device context, operating system, and web browser information. You can override the location values server-side through the HTTP API, or stop Amplitude from using the IP address by disabling IP tracking in the SDK or dropping IP addresses after ingestion.
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. Amplitude fills the event's location properties but leaves the IP address empty.
How Amplitude parses user agent and device information
Amplitude processes device context from client-side SDK fields and, for web events, the user agent string. Amplitude stores the processed values on your events and exposes selected values as built-in properties for analysis.
User agent parsing
Client-side SDKs can send device context that describes:
- 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
Field names differ between event ingestion, exported events, and the Amplitude UI. This table uses the following terms:
- HTTP V2 API field: The top-level field that the HTTP V2 API accepts when you send an event.
- Export API field: The field that the Export API returns after Amplitude processes the event.
- UI label: The name that chart and filter property selectors display.
For example, the Export API returns os_name and os_version as separate fields. The UI combines them and displays the result as OS.
This table covers HTTP V2, the Export API, and the corresponding built-in UI properties. SDK payloads, one-off backfills, and destination-specific warehouse schemas can differ.
| HTTP V2 API field | Export API field | UI label | Relationship |
|---|---|---|---|
user_agent | os_name | OS | For web events, Amplitude uses the parsed browser name when you don't send os_name. |
user_agent | os_version | OS | For web events, Amplitude uses the parsed browser major version when you don't send os_version. |
user_agent | device_family | Device Family | Amplitude can use parsed device context when explicit device fields are absent. |
user_agent | device_type | Device Type | Amplitude can use parsed device context as a fallback. The device type can remain empty when no mapping exists. |
os_name | os_name | OS | The explicit input takes precedence over the value parsed from user_agent. |
os_version | os_version | OS | The explicit input takes precedence over the value parsed from user_agent. |
device_brand | device_family | Device Family | Amplitude combines this field with the other supplied device components to derive the family. |
device_manufacturer | device_family | Device Family | Amplitude combines this field with the other supplied device components to derive the family. |
device_model | device_family | Device Family | Amplitude combines this field with the other supplied device components to derive the family. |
device_brand | device_type | Device Type | Amplitude combines this field with the other supplied device components and looks up the result in the device mapping. |
device_manufacturer | device_type | Device Type | Amplitude combines this field with the other supplied device components and looks up the result in the device mapping. |
device_model | device_type | Device Type | Amplitude combines this field with the other supplied device components and looks up the result in the device mapping. |
platform | platform | Platform | Amplitude retains the field name. |
Amplitude doesn't expose separate built-in browser or browser_version fields. Browser SDKs send user_agent. For web traffic, Amplitude stores the parsed browser name and major version in os_name and os_version. The UI combines those fields in the OS property.
Amplitude combines device_brand, device_manufacturer, and device_model to determine standardized device_family and device_type values. A recognized combination maps to Amplitude's standardized device family and type. An unrecognized family can use a combined description of the supplied device components, while device_type can remain empty when no type mapping exists.
The UI uses Device Family for broad groups such as Apple iPhone or Samsung Galaxy Phone. It uses Device Type for specific types such as Apple iPhone 6 or Samsung Galaxy S5. For the complete list of built-in properties, go to Default user properties.
How user agent parsing works
- Client-side collection: The Browser SDK sends the user agent string with the event. Other SDKs can send device context through their supported fields.
- Server-side parsing: For web events, Amplitude parses
user_agentfor browser and device context. Explicitos_name,os_version, and device fields take precedence over values that Amplitude derives from the user agent. - Property assignment: Amplitude stores processed values in the event fields listed in the Export API column.
- Analysis availability: Amplitude exposes the properties listed in the UI label column for segmentation, filtering, and analysis.
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,
});
これは役に立ちましたか?