由于 Measurement Procotol 支持来自 Google Analytics for Firebase SDK 和 gtag.js 的 ID,因此请确保您使用的是正确的 ID。您应该使用的 ID 取决于您使用的是 Google Analytics for Firebase SDK 还是 gtag.js。下文简要介绍了您应该使用哪些 ID:
Google Analytics for Firebase SDK
如果您使用的是 Google Analytics for Firebase SDK,则应该使用以下 ID:
firebase_app_id - 可将此 ID 添加到请求的查询参数中。此 ID 可唯一标识您的 Firebase 应用。您的应用的所有用户都具有相同的 firebase_app_id。此值可在 Firebase 控制台中的以下位置下找到: 项目设置 > 常规 > 您的应用 > 应用 ID
app_instance_id - 可将此 ID 添加到请求的 POST 正文中。此 ID 可唯一标识 Firebase 应用的指定安装。此值会因应用的每次安装而异。各个 Firebase 平台请求此值的方法如下所示:
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-11-07。"],[[["This guide helps troubleshoot common Google Analytics 4 Measurement Protocol implementation errors, focusing on missing events and invalid user/device IDs."],["If events aren't appearing, ensure your `api_secret` is correct, valid, accurately copied, and you're using the appropriate device identifier (`app_instance_id` or `client_id`, not `advertising_id`)."],["When using the Measurement Protocol, select the correct IDs based on whether you're implementing via Firebase or gtag.js, as outlined in the guide."],["For Firebase, utilize `firebase_app_id` and `app_instance_id`, avoiding `firebase_instance_id`."],["For gtag.js, use `measurement_id` and `client_id` for proper event tracking."]]],["To resolve event visibility issues in Google Analytics, verify the correct `api_secret` is used, valid, and copied accurately, and avoid using `advertising_id`. For Firebase, use `firebase_app_id` in query parameters and `app_instance_id` in the POST body; retrieve `app_instance_id` using the appropriate platform's method. For gtag.js, utilize `measurement_id` in query parameters and `client_id` in the POST body. Both `client_id` and `app_instance_id` should differ for each user.\n"]]