教程:使用 AdMob、Google Analytics(分析)和 Firebase 优化混合变现模式
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
第 2 步:设置 Google Analytics
Google Analytics 会收集和分析您用户的相关信息,
可帮助您定位特定的用户群体,提供更加个性化的应用体验,例如
这里所说的应用内广告体验
在您的应用中添加 Google Analytics for Firebase SDK
要将 Google Analytics 与 AdMob 和 Firebase 搭配使用,您需要将
Google Analytics for Firebase SDK 添加到应用的代码库。
此 SDK 会自动记录某些事件和用户维度;你不
您需要添加任何代码才能启用它们。Google Analytics 会将这些数据用于
将用户细分为不同的受众群体。
请注意,您的应用应已安装了以下 SDK 的 Google Mobile Ads (AdMob) SDK
本教程的上一步。
Swift
在您的 podfile 中添加并安装 Google Analytics for Firebase pod:
pod 'Firebase/Analytics'
Android
将 Google Analytics for Firebase 库依赖项添加到您的
build.gradle
文件:
implementation 'com.google.firebase:firebase-analytics:23.0.0'
Flutter
从 Flutter 项目的根目录运行以下命令,
Google Analytics for Firebase 插件:
flutter pub add firebase_analytics
Unity
下载并安装最新版
Firebase Unity SDK,然后将
将 Google Analytics for Firebase 软件包添加到您的项目中:
FirebaseAnalytics.unitypackage
了解 Google Analytics 受众群体
使用 Google Analytics,您可以将用户细分为受众群体,即
一组具有共同特征的用户。指定受众群体中的所有用户
在您的应用中表现出了相同的行为(例如,向
和/或分享受众特征或其他描述性数据(例如年龄)
范围)。
Google Analytics 会自动提供“购买者”您作为默认受众群体
这对大多数应用来说都很常见进行过应用内购买或电子商务的任何用户
都会有购买行为。
采用混合变现策略时,您不希望在应用内展示广告
向进行过购买的用户展示广告您可以利用 Google Analytics
“购买者”受众群体Firebase Remote Config。
以下是一些 Google Analytics 资源,可帮助您详细了解受众群体:
在本教程的下一步中,您将使用“购买者”受众群体
设置Firebase Remote Config。
<ph type="x-smartling-placeholder"></ph>
arrow_back_ios第 1 步:使用 AdMob 创建新的展示广告广告单元
第 3 步:设置 Remote Config 以展示特定的广告体验
arrow_forward_ios
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["Step 2: Set up Google Analytics\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------|\n| Introduction: [Optimize hybrid monetization using AdMob, Google Analytics, and Firebase](/docs/tutorials/optimize-hybrid-monetization) |\n| Step 1: Use AdMob to create new ad units for display |\n| **Step 2: [Set up Google Analytics](/docs/tutorials/optimize-hybrid-monetization/step-2)** \u003cbr /\u003e |\n| Step 3: [Set up Firebase Remote Config to show specific ads experiences](/docs/tutorials/optimize-hybrid-monetization/step-3) |\n\n\u003cbr /\u003e\n\nGoogle Analytics collects and analyzes information about your users, which can\nhelp you target specific groups of users with more customized app experiences ---\nin this case, their in-app ads experience.\n\n**Add the Google Analytics for Firebase SDK to your app**\n\nTo use Google Analytics with AdMob and Firebase, you need to add the\nGoogle Analytics for Firebase SDK to your app's codebase.\n\nThis SDK will automatically log certain events and user dimensions; you don't\nneed to add any code to enable them. Google Analytics will use this data to\nsegment your users into audiences.\n\nNote that your app should already have the Google Mobile Ads (AdMob) SDK from\nthe previous step of this tutorial. \n\nSwift\n\nAdd and install the Google Analytics for Firebase pod in your podfile: \n\n pod 'Firebase/Analytics'\n\nAndroid\n\nAdd the Google Analytics for Firebase library dependency to your\n`build.gradle` file: \n\n implementation 'com.google.firebase:firebase-analytics:23.0.0'\n\nFlutter\n\nFrom the root of your Flutter project, run the following command to install\nthe Google Analytics for Firebase plugin: \n\n flutter pub add firebase_analytics\n\nUnity\n\nDownload and install the latest\n[Firebase Unity SDK](https://firebase.google.com/download/unity), and then add\nthe Google Analytics for Firebase package to your project: \n\n`FirebaseAnalytics.unitypackage`\n\n**Understand Google Analytics audiences**\n\nUsing Google Analytics, you can segment your users into **audiences**, which are\ngroups of users who share the same attributes. All the users in a given audience\nhave exhibited the same behavior in your app (for example, added an item to\ncart) and/or share demographic or other descriptive data (for example, age\nrange).\n\nGoogle Analytics automatically provides a \"Purchasers\" default audience that's\ncommon for most apps. Any user who has made an in-app purchase or an ecommerce\npurchase will be placed in this audience.\n\nWhen using a hybrid monetization strategy, you do **not** want to show in-app\nads to users who have made a purchase. So you can leverage this Google Analytics\naudience of \"Purchasers\" when you set up Firebase Remote Config.\n\nHere are some Google Analytics resources to learn more about audiences:\n\n- [Introduction to audiences in Google Analytics](https://support.google.com/analytics/answer/12799087)\n\n- [Examples of audiences in Google Analytics and how to create them](https://support.google.com/analytics/answer/12799863)\n\nIn the next step of this tutorial, you'll leverage the \"Purchasers\" audience in\nsetting up Firebase Remote Config.\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\n[arrow_back_ios**Step 1** : Use AdMob to create new ad units for display](/docs/tutorials/optimize-hybrid-monetization)\n[**Step 3** : Set up Remote Config to show specific ads experiences\narrow_forward_ios](/docs/tutorials/optimize-hybrid-monetization/step-3)\n\n\u003cbr /\u003e\n\n*** ** * ** ***"]]