Firebase 将于 5 月 14 日重返 Google I/O 大会!
立即报名。
编写宣传活动
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
准备工作
请务必完成使用入门中的步骤,确保您的应用已启用 Firebase 并已添加最新的 Firebase In-App Messaging SDK。
创建新的宣传活动
在 Firebase 控制台的“Messaging”(消息传递)页面中设置新的宣传活动。
- 如果您是首次使用该功能,请点击制作首个宣传活动。
- 如果不是,请点击新建宣传活动。
第 1 步:样式和内容
在控制台中,使用 Firebase In-App Messaging 消息模板来整合不同的功能,以便为您的应用内消息提供不同的用途。
探索使用场景,查看设置消息模板样式的示例。
消息模板类型 |
功能 |
功能说明 |
卡片 |
模态窗口 |
仅图片 |
横幅 |
lens |
lens |
lens |
lens |
图片 |
提供 HTTPS 图片网址。您可以使用 Firebase Hosting 来托管您的图片。 |
lens |
lens |
lens |
lens |
操作 |
使用 Web 链接或深层链接将您的用户引导至外部页面或您的应用中的特定页面。您可以使用 Firebase Dynamic Links 来创建和管理深层链接。模态窗口和仅图片模板包含一个 X 按钮,可供用户关闭消息。 |
lens |
lens |
|
lens |
文本/背景颜色 |
您可以通过输入十六进制颜色代码或使用颜色渐变找到与您的品牌契合的特定色相,自定义消息的视觉效果。 |
lens |
lens |
|
lens |
消息标题/正文 |
通过相关标题和简单说明来吸引用户的注意。Firebase 会根据您的用户的情况自动对您的文本进行翻译和缩放。 |
lens |
lens |
|
|
主按钮 |
默认按钮操作设置为关闭消息。请以操作的形式提供一个网址来重定向用户。 |
lens |
|
|
|
次要按钮 |
默认按钮操作设置为关闭消息。请以操作的形式提供一个网址来重定向用户。 |
在 Firebase 控制台的编写宣传活动窗口中,使用每个模板可用的功能自定义您想显示的消息。
在编写宣传活动窗口的右侧,横向或纵向预览手机或平板电脑上的消息。
通过在控制台内预览,您可以大致了解您的消息显示在移动设备上的样子。消息的实际呈现效果因设备而异。
使用真机设备进行测试,以查看实际呈现效果。
如果需要,请为您的宣传活动定义自定义元数据。在客户端向用户显示宣传活动时,通过 SDK 回调来获得这些元数据。
例如,您可能希望用促销代码标记宣传活动,以便在客户端使用。
第 2 步:定位用户
输入宣传活动的名称。
此名称用于宣传活动报告,不会显示在消息中。
(可选)提供宣传活动说明。
此说明用于宣传活动报告,不会显示在消息中。
点击选择应用下拉列表,找到您要关联到此宣传活动的应用。
(可选)点击与按钮,进一步缩小目标用户的范围。
使用选择下拉列表选择其他要求。
查看符合此宣传活动要求的潜在用户所占的百分比。
此数字是根据过去 7 天内与该服务通信过的活跃用户数估算的。符合条件的用户仅会在满足触发条件时看到此消息。
(可选)如果您的应用定位到多种语言的用户,系统会提示您将宣传活动本地化为这些语言。您可以使用对话框添加自己的翻译,或者使用 Google 翻译轻松将宣传活动本地化。
第 3 步:安排消息推送
指定宣传活动的开始日期和时间。
宣传活动可以在您发布宣传活动后开始,也可以在安排的某个时间开始。
指定宣传活动的结束日期和时间。
宣传活动可以无限期推送,也可以在安排的某个时间结束。
点击“事件 +”至少添加一个触发事件。
指定每台设备的推送频率限制。通过此限制,您可以控制用户多久看到一次您的消息。
- 默认情况下,宣传活动在被用户查看(也就是向用户展示)过一次后就不再显示。
- 您也可以以天为单位设置消息推送频率。
第 4 步:转化事件(可选)
Firebase 会跟踪产生已完成转化事件的展示次数。
在编写宣传活动窗口中,使用选择转化事件下拉列表从以下内容中进行选择:
发布宣传活动后,请浏览到“Messaging”(消息传递)页面,然后点击宣传活动的名称,查看与该宣传活动的转化历史记录相关的数据。
发布宣传活动
修改宣传活动后,您可以点击另存为草稿,以便稍后可以继续修改草稿状态的宣传活动。
或者,您也可以点击发布,在安排的日期向定位的用户发布消息。您可以在宣传活动发布后对其进行修改。
一旦停止某个已发布的宣传活动,您将无法再次发布该宣传活动。不过,您可以随时停止或修改推送中的宣传活动。您还可以复制现有的宣传活动,对其略加修改,以避免创建全新的宣传活动。
使用 Gemini in Firebase 获取消息宣传活动的 AI 数据分析
Gemini in Firebase 可提供消息宣传活动摘要、数据分析和指导,帮助您提升 Firebase Cloud Messaging 和 In-App Messaging 宣传活动的效果。通过分析宣传活动数据,Gemini in Firebase 可帮助您了解宣传活动的覆盖面和影响力,并建议一些策略来提高用户互动度和增长率。
访问消息宣传活动的 AI 数据分析
如需使用消息宣传活动的 AI 数据分析,请确保您的项目具备以下方面:
已为您的项目启用 Gemini in Firebase。如需了解详情,请参阅设置 Gemini in Firebase。
您的 Firebase 项目中已启用 Firebase Cloud Messaging 或 In-App Messaging。
至少有一个宣传活动存在并显示在 Firebase 控制台中。
确保满足这些要求后:
在 Firebase 控制台中打开消息传递,以访问宣传活动数据。
宣传活动数据加载完毕后,请点击生成 AI 洞见。
此时会显示消息宣传活动的摘要和分析。
价格
如需了解详情,请参阅 Gemini in Firebase 价格。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[null,null,["最后更新时间 (UTC):2025-08-17。"],[],[],null,["\u003cbr /\u003e\n\nBefore you begin\n\nMake sure you complete the steps in [Get\nStarted](/docs/in-app-messaging/get-started) to\nensure you have an app with Firebase enabled and have added the latest Firebase In-App Messaging\nSDK.\n\nCreate a new campaign\n\nSet up your new campaign in the Firebase console's\n[Messaging page](https://console.firebase.google.com/project/_/messaging).\n\n- If you are a first time user, click **Create your first campaign**.\n- If not, click **New campaign**.\n\nStep 1: Style and content\n\nIn the console, use Firebase In-App Messaging message templates to incorporate different\nfeatures to serve different purposes with your in-app messages.\n\n[Explore use cases](/docs/in-app-messaging/explore-use-cases) to see\nexamples for stylizing the messages templates.\n\n\n| Message Template Type |||| Feature | Feature Description |\n| Feature | Feature Description |\n|---------|---------------------|------------|--------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Card | Modal | Image only | Banner |\n| lens | lens | lens | lens | Image | Provide an HTTPS Image URL. You can use [Firebase Hosting](/docs/hosting) to host your images. |\n| lens | lens | lens | lens | Action | Use weblinks or deep links to send your users to external pages or specific pages in your app. You can use [Firebase Dynamic Links](/docs/dynamic-links) to create and manage deep links. Templates **Modal** and **Image only** include an X button, allowing users to dismiss the message. |\n| lens | lens | | lens | Text/background color | Customize the message visuals by entering the Hex Color Code or using the color gradient to find the specific hue that matches your brand. |\n| lens | lens | | lens | Message title/body | Catch your user's attention with a relevant header and a concise description. Firebase automatically translates and scales your text to accommodate your users. |\n| lens | lens | | | Primary button | The default button action is set to dismiss the message. Provide a URL to redirect users as the action. |\n| lens | | | | Secondary button | The default button action is set to dismiss the message. Provide a URL to redirect users as the action. |\n\n\u003cbr /\u003e\n\n1. In Firebase console's **Compose campaign** window, customize your\n message to your liking with the features available to each template.\n\n2. On the right-hand side of the **Compose campaign** window, preview your message\n in landscape or portrait orientation for a phone or tablet device.\n\n The in-console preview provides a general idea of how your message appears\n on a mobile device. Actual message rendering varies depending on the device.\n [Test with a real device to see the exact rendering](/docs/in-app-messaging/get-started#send_a_test_message).\n3. If desired, define custom metadata for your campaign. This metadata will be available\n on the client side using SDK callbacks when a campaign is displayed to a user.\n For example, you might want to tag the campaign with a promo code that\n you can use on the client.\n\nStep 2: Target your users\n\n1. Enter a name for your campaign.\n\n This name is used for campaign reporting and is not part of the visible\n message.\n2. (Optional) Provide a campaign description.\n\n This description is used for campaign reporting and is not part of the visible\n message.\n3. Click on the **Select app** dropdown and identify which\n app you want to associate with this campaign.\n\n4. (Optional) Click the **and** button to further narrow down your\n target users.\n\n Use the **Select** dropdown to choose additional specifications.\n5. View the percentage of potential users that are eligible for this\n campaign.\n\n This number is estimated based on active users who contacted the service\n in the last 7 days. Eligible users only see this message if a trigger\n condition occurs.\n6. (Optional) If your app targets users in multiple languages, you will be\n prompted to localize the campaign in those languages. Use the dialog to\n either add your own translations or use Google Translate to localize the\n campaign easily.\n\nStep 3: Scheduling your message\n\n1. Describe a start date and time for your campaign.\n\n Your campaign can start when you publish the campaign or have a scheduled\n start.\n2. Describe an end date and time for your campaign.\n\n Your campaign can run indefinitely or have a scheduled endpoint.\n3. Click Event + to add at least one trigger event.\n\n - You can enter default events or [events logged through Firebase Analytics](/docs/analytics/android/events) to trigger your in-app message. These events can be user actions, system events, or errors.\n - Your in-app message is triggered when any of your events occur.\n4. Specify your per-device frequency limit. The limit allows you to\n control how often your users see your message.\n\n - By default, a campaign is not shown after it has been viewed by (that is, impressed on) the user once.\n - Or, you can set the frequency of messages in days.\n\nStep 4: Conversion events (optional)\n\nFirebase tracks the number of impressions that result in a completed conversion\nevent.\n\n1. In the **Compose campaign** window, use the **Select conversion event**\n dropdown to choose from:\n\n - The default conversion events.\n - Any [events you enabled as conversions](https://support.google.com/firebase/answer/6317522#enable).\n2. After you publish the campaign, go to the\n [Messaging page](https://console.firebase.google.com/project/_/messaging)\n and click on the campaign's name to see data related to the\n campaign's conversion history.\n\nPublishing your campaign\n\nAfter modifying your campaign, you can click **Save as draft** for the option to\nreturn and edit the campaign in draft status.\n\nOr, you can click **Publish** to release your message to targeted users on the\nscheduled date. You can edit your campaign after it has been published.\n\nOnce you stop a published campaign, you will not be able to publish it again.\nHowever, you may stop or edit a running campaign at any time. You can also\nduplicate an existing one to make slight variations and avoid creating a\ncompletely new campaigns.\n\nGet AI insights for messaging campaigns with Gemini in Firebase\n\nGemini in Firebase\nprovides messaging campaign summarization, insights,\nand guidance to improve your Firebase Cloud Messaging and In-App Messaging\ncampaign performance. By analyzing campaign data,\nGemini in Firebase can help you understand your campaigns' reach and impact\nand suggests strategies to improve user engagement and growth.\n\nAccess AI insights for messaging campaigns\n\nTo use messaging campaign AI insights, make sure that your project has the\nfollowing:\n\n- Gemini in Firebase is enabled for your project. Learn more at\n [Set up Gemini in Firebase](/docs/gemini-in-firebase/set-up-gemini).\n\n- Firebase Cloud Messaging or In-App Messaging is enabled in your Firebase\n project.\n\n- At least one campaign exists and appears in the Firebase console.\n\nAfter ensuring these requirements are met:\n\n1. Open [**Messaging**](//console.firebase.google.com/project/_/messaging) in the\n Firebase console to access campaign data.\n\n2. After your campaign data loads, click **Generate AI insights**.\n\n A summary and analysis of your messaging campaigns appears.\n\nPricing\n\nSee\n[Gemini in Firebase pricing](/docs/gemini-in-firebase#pricing) for more\ninformation."]]