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.
Google Analytics thu thập dữ liệu về mức sử dụng và hành vi cho ứng dụng của bạn. SDK này ghi lại 2 loại thông tin chính:
Sự kiện: Những gì đang diễn ra trong ứng dụng của bạn, chẳng hạn như hành động của người dùng, các sự kiện của hệ thống hoặc lỗi.
Thuộc tính người dùng: Các thuộc tính do bạn xác định để mô tả các phân khúc trong cơ sở người dùng, chẳng hạn như lựa chọn ưu tiên về ngôn ngữ hoặc vị trí địa lý.
Analytics tự động ghi nhật ký một số sự kiện và thuộc tính người dùng; bạn không cần thêm mã nào để bật các sự kiện và thuộc tính này. Nếu ứng dụng của bạn cần thu thập thêm dữ liệu, bạn có thể thiết lập tối đa 25 Analytics thuộc tính người dùng và ghi nhật ký tối đa 500 Analytics loại sự kiện trong ứng dụng. Không có giới hạn về tổng số lượng sự kiện mà ứng dụng của bạn ghi nhật ký.
Chọn biểu tượng Analytics trong trình đơn để xem trang tổng quan báo cáo Analytics.
Thẻ Sự kiện cho thấy các báo cáo sự kiện được tạo tự động cho từng loại sự kiện Analytics riêng biệt mà ứng dụng của bạn ghi lại. Đọc thêm về trang tổng quan.
Để giúp bạn bắt đầu, SDK Analytics xác định một số sự kiện được đề xuất thường gặp ở nhiều loại ứng dụng, bao gồm cả ứng dụng bán lẻ và thương mại điện tử, du lịch và trò chơi. Để tìm hiểu thêm về những sự kiện này và thời điểm sử dụng, hãy xem bài viết Sự kiện được đề xuất. Để có được thông tin chi tiết tối đa trong báo cáo, hãy ghi lại các sự kiện được đề xuất phù hợp với ứng dụng của bạn và các thông số quy định của sự kiện đó. Nhờ đó, bạn có thể hưởng lợi từ các tính năng Google Analytics mới nhất ngay khi chúng ra mắt.
Xin lưu ý rằng việc thêm Firebase vào dự án C++ của bạn bao gồm các thao tác cả trong bảng điều khiển Firebase và trong dự án C++ đang mở (ví dụ: bạn tải tệp cấu hình Firebase xuống từ bảng điều khiển, sau đó di chuyển các tệp đó vào dự án C++).
Tạo và khởi chạy ứng dụng Firebase
Trước khi bắt đầu, bạn cần tạo và khởi chạy Ứng dụng Firebase:
Android
Tạo ứng dụng Firebase, truyền môi trường jni và một jobjecttham chiếu đến hoạt động java làm đối số:
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-16 UTC."],[],[],null,["Google Analytics collects usage and behavior data for your app. The SDK\nlogs two primary types of information:\n\n- **Events:** What is happening in your app, such as user actions, system events, or errors.\n- **User properties:** Attributes you define to describe segments of your user base, such as language preference or geographic location.\n\nAnalytics automatically logs some\n[events](https://support.google.com/analytics/answer/9234069) and\n[user properties](https://support.google.com/analytics/answer/9268042);\nyou don't need to add any code to enable them. If your app needs to collect\nadditional data, you can set up to 25 different Analytics user properties\nand log up to 500 different Analytics event *types* in your app.\nThere is no limit on the total volume of events your app logs.\n\nTo access this data:\n\n1. In the [Firebase console](//console.firebase.google.com/), open your project.\n2. Select **Analytics** from the menu to view the Analytics reporting dashboard.\n\nThe **Events** tab shows the event reports that are\nautomatically created for each distinct type of Analytics event logged by\nyour app. Read more about the [dashboard](https://support.google.com/analytics/answer/11014767).\n\nTo help you get started, the Analytics SDK defines a number of\nrecommended events that are common among different types of apps, including\nretail and ecommerce, travel, and gaming apps. To learn more about these events\nand when to use them, see [Recommended events](https://support.google.com/analytics/answer/9267735).\nTo get the maximum detail in reports, log\nthe recommended events that make sense for your app and their\nprescribed parameters. This also ensures that you benefit from the latest\nGoogle Analytics features as they become available.\n\nBefore you begin\n\nBefore you can use\n[Google Analytics](/docs/reference/unity/namespace/firebase/analytics),\nyou need to:\n\n- Register your C++ project and configure it to use Firebase.\n\n If your C++ project already uses Firebase, then it's already registered and\n configured for Firebase.\n- Add the [Firebase C++ SDK](/download/cpp) to your C++ project.\n\n| **Find detailed instructions for these initial\n| setup tasks in\n| [Add Firebase to your C++\n| project](/docs/cpp/setup#note-select-platform).**\n\nNote that adding Firebase to your C++ project involves tasks both in the\n[Firebase console](//console.firebase.google.com/) and in your open C++ project (for example, you download\nFirebase config files from the console, then move them into your C++ project).\n\nCreate and initialize the firebase app\n\nBefore you start, you'll need to create and initialize the firebase App: \n\nAndroid\n\nCreate the firebase app, passing the jni environment and a `jobject`\nreference to the java activity as arguments: \n\n```c++\napp = ::firebase::App::Create(::firebase::AppOptions(), jni_env, activity);\n```\n\nInitialize the Analytics library: \n\n```c++\n::firebase::analytics::Initialize(app);\n```\n\n\u003cbr /\u003e\n\niOS+\n\nCreate the firebase app: \n\n```c++\napp = ::firebase::App::Create(::firebase::AppOptions());\n```\n\nInitialize the Analytics library: \n\n```c++\n::firebase::analytics::Initialize(app);\n```\n\n\u003cbr /\u003e\n\nLog events\n\nAfter you have configured the [`firebase::App`](/docs/reference/cpp/class/firebase/app) instance, you can\nbegin to log events with the [`LogEvent()`](/docs/reference/cpp/namespace/firebase/analytics#logevent) method.\n\nThe following example updates the user's score: \n\n```c++\nanalytics::LogEvent(analytics::kEventPostScore, analytics::kParameterScore, 42);\n```\n| **Note:** Once the property is registered, it can take up to 24 hours for data collected with the property to be included in reports. When the new data is available, the user property can be used as a report filter.\n\nNext steps\n\n- See your data refresh periodically in the [Firebase console](//console.firebase.google.com/).\n- Explore the guides on [events](/docs/analytics/cpp/events) and [user properties](/docs/analytics/cpp/properties)."]]