[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eUser properties are attributes that describe segments of your user base, like language or location, and you can set up to 25 custom ones.\u003c/p\u003e\n"],["\u003cp\u003eThe Measurement Protocol allows you to combine server-side data with client-side measurements to enhance user property data.\u003c/p\u003e\n"],["\u003cp\u003eCertain user property names are reserved and cannot be used, including ones that start with \u003ccode\u003egoogle_\u003c/code\u003e, \u003ccode\u003ega_\u003c/code\u003e, or \u003ccode\u003efirebase_\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can send user properties with events or in separate requests to enrich your Analytics data.\u003c/p\u003e\n"],["\u003cp\u003eTimestamps for user properties can be overridden at the request level or individually for specific properties to ensure data accuracy.\u003c/p\u003e\n"]]],["User properties segment users based on characteristics like language or location, with up to 25 custom properties per project. The Measurement Protocol enriches client-side data with server-side insights, improving segmentation. Reserved property names and prefixes cannot be used. Server code can augment client events with user properties like `customer_tier`. Timestamps for properties are prioritized from individual entries to request level, and the most recent property value is used. Overriding timestamps is crucial for historical data.\n"],null,["# Send user properties\n\nUser properties describe segments of your user base, such as language preference\nor geographic location. Analytics [automatically logs some user properties](https://support.google.com/analytics/answer/9268042). If\nyou want to collect additional properties, you can set up to 25 additional user\nproperties per project. See [Custom user properties](https://support.google.com/analytics/answer/9269570) to learn how to set and\nregister user properties.\n\nUser properties enhance user segmentation, but user property data is often only\navailable server-side. The Measurement Protocol lets you augment\nclient-side measurements with server-side data, which is typically infeasible\nusing only client-side solutions.\n\nReserved names\n--------------\n\nSome user property names are reserved and cannot be used in measurements:\n\n- `first_open_time`\n- `first_visit_time`\n- `last_deep_link_referrer`\n- `user_id`\n- `first_open_after_install`\n\nAdditionally, user property names cannot begin with:\n\n- `google_`\n- `ga_`\n- `firebase_`\n\nExample usage\n-------------\n\nFirebase gtag.js\n\nIn the following example, your CRM has a user property (`customer_tier`) you\nwould like to add to your measurements. `customer_tier` can be set to one of\n`premium` or `standard`. To get this user property in your reports, you would do\nthe following:\n\nFirst, have the client send an [`add_payment_info`](/analytics/devguides/collection/protocol/ga4/reference/events#add_payment_info) event along with a call to a\nserver API that has access to your CRM system:\n\n**client code**\n\nYour server then augments the measurement with the `customer_tier` user property\nusing the Measurement Protocol:\n\n**server code**\n| **Tip:** This sample shows how to send a user property along with an event. You can also send a request that *only* contains user properties, without any events.\n\nThis user property reports the two segments `premium` and `standard`.\n| **Key Point:** User properties can improve segmentation using data that's only available server-side through use of the Measurement Protocol.\n\nSee [Sending events](/analytics/devguides/collection/protocol/ga4/sending-events) for full details on how to send events using the\nMeasurement Protocol.\n\nOverride timestamp\n------------------\n\nThe Measurement Protocol uses the *first* timestamp it finds in the following\nlist for each user property in the request:\n\n1. The `timestamp_micros` of the entry in `user_properties`.\n2. The `timestamp_micros` of the request.\n3. The time that the Measurement Protocol receives the request.\n\nThe following example sends a request-level timestamp that applies to all of\nthe user properties in the request. As a result, the Measurement Protocol assigns\nboth the `customer_tier` and `customer_group` user properties a timestamp of\n`requestUnixEpochTimeInMicros`. \n\n {\n \"timestamp_micros\": requestUnixEpochTimeInMicros,\n \"user_properties\": {\n \"customer_tier\": {\n \"value\": customerTierValue\n },\n \"customer_group\": {\n \"value\": customerGroupValue\n }\n }\n }\n\nThe following example sends both a request-level timestamp and a timestamp for\nthe `customer_tier` user property. As a result, the Measurement Protocol assigns\nthe `customer_tier` a timestamp of `customerTierUnixEpochTimeInMicros`, and the\n`customer_group` a timestamp of `requestUnixEpochTimeInMicros`. \n\n \"timestamp_micros\": requestUnixEpochTimeInMicros,\n \"user_properties\": {\n \"customer_tier\": {\n \"value\": customerTierValue,\n \"timestamp_micros\": customerTierUnixEpochTimeInMicros\n },\n \"customer_group\": {\n \"value\": customerGroupValue\n }\n }\n\n| **Tip:** Google Analytics uses the most recent value of a user property for each user. If you're sending user property changes that occurred in the past, override the timestamp to ensure that the user properties from Measurement Protocol don't override more recent changes from tagging or the Firebase SDK."]]