Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
User-ID là giá trị nhận dạng riêng biệt của riêng bạn mà bạn chỉ định cho từng người dùng.
Hướng dẫn này giải thích cách gửi mã nhận dạng người dùng đến Google Analytics, nhờ đó bạn có thể kết nối hành vi của người dùng trên nhiều phiên, thiết bị và nền tảng.
Việc đặt phương diện tuỳ chỉnh dựa trên mã nhận dạng người dùng sẽ dẫn đến các phương diện có quá nhiều giá trị riêng biệt. Việc có quá nhiều giá trị riêng biệt sẽ gây ra vấn đề với dữ liệu và độ chính xác của báo cáo Google Analytics. Tìm hiểu thêm về các phương pháp hay nhất để thiết lập phương diện tuỳ chỉnh.
Trước khi bắt đầu
Trước khi có thể gửi mã nhận dạng người dùng, hãy đảm bảo bạn đã hoàn tất các bước sau:
[null,null,["Cập nhật lần gần đây nhất: 2025-08-17 UTC."],[[["\u003cp\u003eUser IDs, assigned by you, enable tracking user behavior across sessions, devices, and platforms in Google Analytics.\u003c/p\u003e\n"],["\u003cp\u003eTo send user IDs to Google Analytics, ensure you have a Google Analytics account, a web data stream, and the Editor role or higher.\u003c/p\u003e\n"],["\u003cp\u003eAvoid setting custom dimensions based on user IDs and sending user IDs when a user isn't signed in to maintain data accuracy.\u003c/p\u003e\n"],["\u003cp\u003eBefore implementing user IDs, review the best practices and guides linked in the document to avoid potential issues.\u003c/p\u003e\n"]]],["User IDs are unique identifiers assigned to users to track their behavior across sessions, devices, and platforms within Google Analytics. To ensure data accuracy, avoid using user IDs for custom dimensions and only send them when users are signed in; do not set placeholder values. Before sending user IDs, establish a Google Analytics account and web data stream, and ensure the Editor role is assigned.\n"],null,["# Send user IDs\n\nUser IDs are your own unique identifiers that you assign to individual users.\nThis guide explains how to send user IDs to Google Analytics, so you can connect\nuser behavior across different sessions, devices, and platforms.\n\nTo learn more about the User-ID feature, see [Measure\nactivity across platforms](//support.google.com/analytics/answer/9213390). To learn how to set a user ID for an app, see [Set a\nuser ID](//firebase.google.com/docs/analytics/userid).\n| **Warning:** Don't set custom dimensions based on user IDs.\n\nSetting custom dimensions based on user IDs leads to dimensions with too many\nunique values. Having too many unique values causes issues with Google\nAnalytics data and reporting accuracy. [Learn more about best practices for\nsetting custom\ndimensions](//support.google.com/analytics/answer/14240153#best-practices).\n\n\u003cbr /\u003e\n\n\ngtag.js Tag Manager\n\nBefore you begin\n----------------\n\nBefore you can send user IDs, make sure you've completed the following:\n\n- [Create a Google Analytics account and property](https://support.google.com/analytics/answer/9304153#account).\n- [Create a web data stream for your website](https://support.google.com/analytics/answer/9304153#stream&zippy=%2Cweb).\n- Have the [Editor](https://support.google.com/analytics/answer/9305587) role (or above) to the Google Analytics account.\n\nSend user IDs\n-------------\n\nThe value you send for `user_id` depends on the state of\nthe user:\n\n- **User has never signed in** : Don't send the `user_id` parameter.\n- **User is signed-in**: Send their user ID.\n- **User was signed-in, then signed out** : Send `null`."]]