教程:使用第一方数据衡量 iOS 应用广告系列带来的 Google Ads 转化
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
解决方案教程
Google 的设备端转化衡量功能可以提高 iOS 应用广告系列中的可观测转化量,同时还能确保用户个人数据的私密性。在本教程中,您将了解该解决方案的运作方式,并按照实现该解决方案所需的步骤操作。
如何使用此功能?
设备端转化衡量功能可帮助您衡量 iOS 应用广告系列带来的应用安装和应用内操作。Google Analytics for Firebase SDK 使用用户在应用登录流程中提供的身份信息在设备端执行归因。在执行设备端转化衡量的过程中,用户的身份信息始终会处于隐藏状态,这样所有个人身份信息都会保留在用户的设备上。
如需使用此技术,您需要获得用户同意,并使用用户提供的电子邮件地址或电话号码。Google Analytics 会通过 initiateOnDeviceConversionMeasurement()
API 使用电子邮件地址或电话号码来为 Firebase SDK 进行归因,以确保这些个人数据绝不会以可识别用户或设备的方式发送到设备之外。此功能适用于搭载 iOS 12 及更高版本的应用。
您可以使用 Firebase Authentication 允许用户通过一种或多种登录方法登录您的应用。与 Firebase Authentication 集成后,您可以获取已登录用户的电子邮件地址或电话号码,以发送到 Firebase SDK for Google Analytics。
本教程中使用的产品和功能
Google Ads
Google Ads 可帮助您提升安装量、深入分析广告转化情况,并利用 Google Analytics 受众群体投放有针对性的广告系列来吸引用户群。
Google Analytics
Google Analytics 可让您深入了解用户互动度、留存率和创收指标,例如总收入、AdMob收入、购买收入等等。它还允许您创建用户受众群体和细分用户群。
|
Firebase Authentication
Firebase Authentication 提供了后端服务、易用的 SDK 以及现成的界面库,以便向您的应用验证用户的身份。该功能支持通过密码、电话号码、主流联合身份提供方服务(如 Google、Facebook 和 Twitter 等)进行身份验证。
|
教程概览
直接前往逐步讲解的教程
实现登录体验
使用 Firebase Authentication 构建登录体验。
或者,将 Firebase Authentication 与您的自定义登录体验相结合。
在登录界面中,获取用户的电子邮件地址或电话号码。
将 Google Analytics 集成到您的应用中
按照 Cocoapods、Swift Package Manager 或手动安装的集成步骤操作。
(可选)在 Xcode 中启用调试模式。
启动设备端转化衡量
使用您收集的电子邮件地址或电话号码调用 on-device measurement API。
使用调试日志验证 API 函数。
排查和处理常见问题
如有需要,请借助 Firebase Authentication 和 Google Analytics 的支持资源进行问题排查。
处理一些常见问题。
您需要满足的条件
第 1 步:实现登录体验arrow_forward_ios
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["**Solution tutorial**\n\nGoogle's on-device conversion measurement improves the number of observable\nconversions from your iOS app campaigns while keeping users' personal data\nprivate. In this tutorial, you'll learn how the solution works and follow along\nwith the steps needed to implement it.\n\nHow does this work?\n\nOn-device conversion measurement helps measure app installs and in-app actions\nfrom your iOS app campaigns. The Google Analytics for Firebase SDK\nperforms on-device attribution using a user's identity provided by your app's\nsign-in experience. The user's identity is hidden through our on-device\nconversion approach so that no personally identifiable information ever leaves\nthe user's device.\n\nTo use this technology, you need a consented, user-provided email address or\nphone number. Through the `initiateOnDeviceConversionMeasurement()` API, the\nemail address or phone number is used by the Google Analytics for\nFirebase SDK for attribution such that this personal data is never sent off the\ndevice in a way that can identify the user or device. The feature works on apps\nrunning iOS 12+.\n\nYou can use Firebase Authentication to allow users to sign in to your app using\none or more sign-in methods. Once integrated with Firebase Authentication, you can get\nthe signed-in user's email or phone number to send to the Google Analytics\nfor Firebase SDK.\n\nProducts and features used in this tutorial\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Google Ads \u003e [Google Ads](/docs/ads) lets you drive installs, gain deep insights into ad conversions, and run targeted ad campaigns using Google Analytics audiences to engage your user base. Google Analytics \u003e [Google Analytics](/docs/analytics) gives you insight into user engagement, retention, and monetization metrics like total revenue, AdMob revenue, purchase revenue, and much more. It also allows you to create user audiences and segments. | Firebase Authentication \u003e [Firebase Authentication](/docs/auth) provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports authentication using passwords, phone numbers, popular federated identity providers (like Google, Facebook, and Twitter), and more. |\n\n\u003cbr /\u003e\n\nTutorial overview\n\n[Go\ndirectly to the step-by-step tutorial](/docs/tutorials/ads-ios-on-device-measurement/step-1)\n\n1. [**Implement\n a sign-in experience**](/docs/tutorials/ads-ios-on-device-measurement/step-1)\n\n 1. Use Firebase Authentication to build a sign-in experience.\n\n 2. Or, combine Firebase Authentication with your custom sign-in experience.\n\n 3. In your sign-in interface, get the user's email address or phone number.\n\n2. [**Integrate\n Google Analytics into your app**](/docs/tutorials/ads-ios-on-device-measurement/step-2)\n\n 1. Follow integration steps for Cocoapods, Swift Package Manager or manual\n installation.\n\n 2. Optionally, enable debug mode in Xcode.\n\n3. [**Initiate\n on-device conversion measurement**](/docs/tutorials/ads-ios-on-device-measurement/step-3)\n\n 1. Call the on-device measurement API with the email or phone number you\n gathered.\n\n 2. Verify API function with debug logs.\n\n4. [**Troubleshoot and\n handle common issues**](/docs/tutorials/ads-ios-on-device-measurement/step-4)\n\n 1. If needed, troubleshoot with the help of support resources for\n Firebase Authentication and Google Analytics.\n\n 2. Handle some commonly-encountered issues.\n\nWhat you'll need\n\n- Your own app that can run on iOS 12 or higher\n\n- Your app registered as a Firebase App that's linked to Google Analytics\n and Ads\n\n- Your preferred IDE\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\n[**Step 1** : Implement a sign-in experiencearrow_forward_ios](/docs/tutorials/ads-ios-on-device-measurement/step-1)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n*** ** * ** ***"]]