![]() |
VOOZH | about |
Audience segmentation is an important strategy for app developers to understand and engage with their users effectively. By dividing users into distinct groups based on behavior, demographics, or other attributes developers can customize marketing campaigns, analyze user behavior, and improve user retention.
Here, We will learn about Create and Segment Audiences on Firebase in detail.
An Audience in Firebase is a group of users who share similar attributes or behaviors. Audience segmentation involves dividing our users into distinct groups based on specific criteria such as behavior, demographics, or other attributes. By segmenting your users into different audiences, you can tailor your marketing efforts, in-app messages, and other interactions to better suit their preferences and actions.
This allows you to:
Before diving into audience segmentation, ensure you have a Firebase project set up and your app integrated with Firebase. Follow these steps if you haven't done so:
For detailed setup instructions, refer to the Firebase documentation.
Audiences in Firebase are defined based on user properties, events, or a combination of both. Common criteria include:
Let us look at some of the examples of creating an Audience in Firebase:
Let's create an audience of active users who have opened the app at least 10 times in the last 30 days.
Let's create an audience of users who have a premium subscription.
Let us now learn segmenting Audiences on Firebase.
User properties are attributes we define to describe segments of our user base. Examples include "subscription_type" or "user_level."
Set user properties in our app using the Firebase SDK.
import com.google.firebase.analytics.FirebaseAnalytics;
// Initialize Firebase Analytics
FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
// Set user property
mFirebaseAnalytics.setUserProperty("subscription_type", "premium");
import Firebase
// Initialize Firebase Analytics
let analytics = Analytics.self
// Set user property
analytics.setUserProperty("premium", forName: "subscription_type")
import { getAnalytics, setUserProperties } from "firebase/analytics";
const analytics = getAnalytics();
// Set user property
setUserProperties(analytics, { subscription_type: 'premium' });
Events are actions users take in our app, such as "app_open" or "purchase." Use these events to segment our audience.
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_ID, "id123");
params.putString(FirebaseAnalytics.Param.ITEM_NAME, "item_name");
params.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, params);
analytics.logEvent(AnalyticsEventSelectContent, parameters: [
AnalyticsParameterItemID: "id123" as NSObject,
AnalyticsParameterItemName: "item_name" as NSObject,
AnalyticsParameterContentType: "image" as NSObject
])
import { logEvent } from "firebase/analytics";
// Log event
logEvent(analytics, 'select_content', {
item_id: 'id123',
item_name: 'item_name',
content_type: 'image'
});
Firebase provides detailed reports for each audience you create.
Outputs
Here are some of the Advanced Audience Segmentation on Firebase:
Custom user properties allow us to segment users based on attributes specific to your app.
Let's set a custom user property "user_level" to segment users based on their experience level.
mFirebaseAnalytics.setUserProperty("user_level", "beginner");
analytics.setUserProperty("beginner", forName: "user_level")
setUserProperties(analytics, { user_level: 'beginner' });
Create more sophisticated audiences by combining multiple conditions.
Firebase Predictions use machine learning to predict user behavior, allowing for more advanced segmentation. For instance, you can create audiences based on predicted churn or high spenders.
Custom event parameters allow for even more detailed segmentation. You can track specific actions within events, like the amount spent in a purchase event.
Bundleparams = new Bundle();
params.putString(FirebaseAnalytics.Param.CURRENCY, "USD");
params.putDouble(FirebaseAnalytics.Param.VALUE, 9.99);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.PURCHASE, params);
analytics.logEvent(AnalyticsEventPurchase, parameters: [
AnalyticsParameterCurrency: "USD" as NSObject,
AnalyticsParameterValue: 9.99 as NSObject
])
logEvent(analytics, 'purchase', {
currency: 'USD',
value: 9.99
});
Audience segmentation is a valuable strategy for app developers to personalize user experiences, optimize marketing efforts, and improve overall app performance. By setting up Firebase for audience segmentation and creating targeted audiences based on user properties and events, developers can gain insights into user behavior and make data-driven decisions to enhance their app's success.