Get Started with Firebase Predictions

You can use Firebase Predictions to predict user behavior. Your predictions are automatically available in Firebase Remote Config, the Notifications composer, Firebase In-App Messaging, and A/B Testing to help you customize the experience for predicted user segments.

This guide shows you how to use Predictions with your app, following these steps:

  1. Add Analytics and any custom events to your app.
  2. Enable Analytics data sharing in your app.
  3. Create and evaluate predictions.
  4. See the effects of different risk tolerance levels.
  5. Access a prediction from your app with Remote Config.
  6. Use a prediction with the Notifications composer.

Add Analytics and any custom events to your app

Before you start using Predictions, add Analytics to your app. It is helpful, though not required, to add some additional events to capture key events and interactions in your app. Use the Firebase console to mark the most important events as conversion events.

This guide assumes that your app uses the predefined churn and spend predictions that are available when you add Analytics to your app. But, this guide also tells you how to add additional Analytics events to your app so that you can predict other types of user behavior, such as the following:

  • When users spend a virtual in-app currency, as might occur in gaming apps. For this prediction, you need to use the spend_virtual_currency Analytics event in your app.
  • When users share app content, as might occur in most non-gaming apps with some type of social media integration. For this prediction, you need to use the share Analytics event in your app.

To learn more about these events, see Events: All apps.

iOS

  1. Add Analytics to your app, using the instructions in the Analytics get started guide for iOS.

  2. Add additional events that you want to predict to your app, such as spend_virtual_currency or share. For instructions, see the Analytics log events guide for iOS. Use the following Analytics constants to log these events in your app: kFIREventSpendVirtualCurrency and kFIREventShare.

Android

  1. Add Analytics to your app, using the instructions in the Analytics get started guide for Android.

  2. Add additional events that you want to predict to your app, such as spend_virtual_currency or share. For instructions, see the Analytics log events guide for Android. Use the following Analytics constants to log these events in your app: SPEND_VIRTUAL_CURRENCY and SHARE.

Enable Analytics data sharing and Predictions in your app

  1. On the Firebase console navigation bar, click settings and select Project Settings.

  2. On the Project Settings page, click the Data Privacy tab, and then make sure the Share Analytics data with all Firebase features setting is enabled.

    To learn more about sharing settings, see Manage data sharing.

  3. Then, in the Firebase console, open the Predictions section. If you haven't already agreed to the Predictions terms of service, do so.

After you have enabled data sharing and have agreed to the terms of service, Predictions will be enabled for your project. You can stop making predictions any time by disabling data sharing with Firebase Predictions from this page.

Create and evaluate predictions

By default, Predictions will try to create churn and spend predictions for your app. If you do not have spend events in your app, you may hide the spend prediction card by clicking the overflow menu on the top right side of the prediction card and selecting Hide.

Other predictions that you might want to add depend on the type of app:

  • For gaming apps with some type of virtual currency, such as gold pieces in an adventure game, you could include a prediction based on the spend_virtual_currency Analytics event.
  • For non-gaming apps with a social component, such as sharing stories from a news app using SMS or social media, you should include a prediction based on the share Analytics event.

Depending on the number of users and Analytics events, you might be able to use these predictions as soon as a day or two after you start collecting these events from your app.

For instructions on creating a prediction, see Create a prediction.

See the effects of different risk tolerance levels

When you use a prediction to target users in Remote Config and the Notifications composer, you may set a risk tolerance level to manage the tradeoff between targeting more users with lower accuracy or fewer users with higher accuracy.

You can preview the effects of each risk profile on targeting accuracy and the percentage of your users that will be targeted by adjusting the slider on the Predictions cards in the Firebase console.

Access a prediction from your app with Remote Config

Predictions are automatically available in Remote Config.

To access a prediction with Remote Config, you first define a Remote Config parameter that controls some behavior in your app, such as background color. Then, you set a condition that changes the parameter's value from the default value for users in a particular predicted segment.

When you retrieve parameter values in you app using the Remote Config SDK, you get the values that correspond with the current user's predicted segment.

See Use a prediction with Remote Config.

How you use a prediction to change the behavior and appearance of your app for users in a predicted segment depends on how you are using Remote Config in your app. Below are two examples of how you might use one or more predictions with Remote Config in a gaming app and in a non-gaming app:

  • For gaming apps with some type of virtual currency, such as gold pieces in an adventure game, you could change the game to reduce in-game virtual currency prices for users who are predicted to spend by recent spend_virtual_currency Analytics events. Depending on your game economy, it might make sense to use a high risk tolerance.
  • For non-gaming apps with a social component, such as sharing stories from a news app using SMS or social media, you could change your app to make the sharing UI more prominent for users who are predicted to share app content. Because such a change would be unlikely to have a negative impact on users who were incorrectly predicted to share app content, you might choose to use a high risk tolerance.

To learn more about risk tolerance, see Prediction Risk Tolerance.

Use a prediction with the Notifications composer

Predictions are automatically available for targeting in the Notifications composer.

Below are two examples of how you might use one or more predictions with the Notifications composer in a gaming app and in a non-gaming app:

  • For gaming apps with some type of virtual currency, such as gold pieces in an adventure game, you could send a one-time or a recurring notification campain advertising certain in-game goods to users who are predicted to spend.

  • For non-gaming apps with a social component, such as sharing top stories from a news app using SMS or social media, you could send notification messages to users who are predicted to share app content when a new story breaks. Because users who share news stories will probably like being the first users to learn about top stories, such a change would be unlikely to have a negative impact, so it makes sense to use a high risk tolerance in this situation.

You can create a one time the Notifications composer campaign to users who are currently included in a particular prediction or you can set up a recurring campaign so a message will be automatically sent every time a new user is added to a certain prediction.

For instructions on adding a prediction to the Notifications composer, see Use a prediction with the Notifications composer.

To learn more about risk tolerance levels, see Prediction Risk Tolerance.

Send feedback about...

Need help? Visit our support page.