How to Use Segmentation in App Push Notifications Using PushEngage

PushEngage lets you group your app subscribers into segments so you can target specific audiences with relevant notifications instead of broadcasting to everyone at once. This guide covers both static segments, where a subscriber stays in the group until you remove them, and dynamic segments, where the subscriber is automatically removed after a set number of days. It includes dashboard setup, iOS and Android SDK methods, and links to the REST API for server-side management.

Innan du börjar

How App Push Segmentation Works

When a user opens your app and your SDK code calls an add-segment method, PushEngage registers that device under the matching segment in your account. From that point on, any campaign you target to that segment will include that subscriber.

There are two segment types:

Static segments persist until you explicitly remove the subscriber. Use these for permanent groupings that reflect a fixed state, such as a subscriber’s plan tier, preferred content category, or onboarding step completed.

Dynamic segments have a time limit you define in days. PushEngage automatically removes the subscriber from the segment after that period expires without any action required from your app. Use dynamic segments for temporary states such as a recent purchase window, an active trial period, or a post-booking hold.

Both types are created the same way in the dashboard. The difference is in the SDK method you call to add subscribers to them.

Step 1: Create a Segment in the Dashboard

Before your SDK can assign a subscriber to a segment, the segment must exist in PushEngage.

  1. Log in to your PushEngage account at app.pushengage.com.
  2. Gå till Målgrupp » Segment.
  3. Klicka på Skapa ett nytt segment.
  4. Enter a segment name. Use a name that is descriptive and easy to reference in code, for example “Recent Buyers” or “Premium Users”.
  5. Klicka på Spara segment.

[Screenshot: The Audience » Segments page showing the Create a New Segment button and a list of existing segments]

You do not need to add URL patterns or rules when creating segments for app push. The SDK handles assignment programmatically.

[Screenshot: The Create Segment dialog with a segment name entered and the Save Segment button visible]

Repeat this step for each segment you want to use.

Step 2: Add an App Subscriber to a Segment (iOS)

Call the segment methods from wherever it makes sense in your app’s logic, such as after a purchase is confirmed, after a user selects a content preference, or when a specific screen is viewed.

Static Segment (iOS)

Use addSegments to add the current subscriber to one or more segments permanently.

PushEngage.addSegments(["Premium Users", "US Customers"]) { response, error in
    if response {
        print("Segments added successfully.")
    } else {
        if let error = error {
            print("Failed to add segments: \(error.localizedDescription)")
        }
    }
}

To remove a subscriber from a static segment:

PushEngage.removeSegments(["US Customers"]) { response, error in
    if response {
        print("Segments removed successfully.")
    }
}

Dynamic Segment (iOS)

Use addDynamicSegments to add the subscriber to a segment for a fixed number of days. PushEngage automatically removes the subscriber when the duration expires.

Each entry in the array is a dictionary with two keys: "name" (the segment name as it appears in the dashboard) and "duration" (the number of days to keep the subscriber in that segment).

let dynamicSegments: [[String: Any]] = [
    ["name": "Recent Buyers", "duration": 30],
    ["name": "Trial Active", "duration": 14],
]

PushEngage.addDynamicSegments(dynamicSegments) { response, error in
    if response {
        print("Dynamic segments updated successfully.")
    } else {
        if let error = error {
            print("Failed to update dynamic segments: \(error.localizedDescription)")
        }
    }
}

Full method signatures are available in the iOS SDK Reference.

Step 3: Add an App Subscriber to a Segment (Android)

Static Segment (Android)

Use addSegment to add the current subscriber to one or more segments permanently. Pass a list of segment names matching exactly what you created in the dashboard.

Java:

List<String> segmentList = new ArrayList<>();
segmentList.add("Premium Users");

PushEngage.addSegment(segmentList, new PushEngageResponseCallback() {
    @Override
    public void onSuccess(Object responseObject) {
        // Segment added successfully
    }

    @Override
    public void onFailure(Integer errorCode, String errorMessage) {
        // Handle failure
    }
});

To remove a subscriber from a static segment:

List<String> segmentList = new ArrayList<>();
segmentList.add("Premium Users");

PushEngage.removeSegment(segmentList, new PushEngageResponseCallback() {
    @Override
    public void onSuccess(Object responseObject) {
        // Segment removed successfully
    }

    @Override
    public void onFailure(Integer errorCode, String errorMessage) {
        // Handle failure
    }
});

Dynamic Segment (Android)

Use addDynamicSegment to add the subscriber to a segment for a set number of days. Create a Segment object with a name and duration, then pass it in a list.

Java:

AddDynamicSegmentRequest addDynamicSegmentRequest = new AddDynamicSegmentRequest();
List<AddDynamicSegmentRequest.Segment> segments = new ArrayList<>();
AddDynamicSegmentRequest.Segment segment = addDynamicSegmentRequest.new Segment("Recent Buyers", 30);
segments.add(segment);

PushEngage.addDynamicSegment(segments, new PushEngageResponseCallback() {
    @Override
    public void onSuccess(Object responseObject) {
        // Dynamic segment added successfully
    }

    @Override
    public void onFailure(Integer errorCode, String errorMessage) {
        // Handle failure
    }
});

Full method signatures and Kotlin equivalents are available in the Android SDK Reference.

Step 4: Target a Segment in a Campaign

Once subscribers are assigned to segments, you can target those segments when creating any push notification campaign.

  1. Go to Campaign » Push Broadcasts (for one-off sends) or open a trigger campaign you want to configure.
  2. Click Create New Push Broadcast or open an existing campaign.
  3. Fill in the notification title, message, and URL.
  4. In the Audience section, select Send to a Segment.
  5. Choose the segment name from the dropdown.
  6. Complete the rest of the campaign settings and schedule or send.

[Screenshot: The campaign creation page with the Audience section expanded, showing "Send to a Segment" selected and a segment chosen from the dropdown]

You can also target multiple segments at once or combine segment targeting with other audience filters using Audience Groups. See the Audience Groups documentation for more detail.

Step 5: Manage Segments via the REST API (Optional)

If your app’s server handles subscriber management, you can use the PushEngage REST API to create segments and assign subscribers without going through the mobile SDK.

The REST API segment endpoints are:

EndpointMethodVad det gör
https://api.pushengage.com/apiv1/segmentsPOSTCreate a new segment
https://api.pushengage.com/apiv1/segmentsGETView all segments
https://api.pushengage.com/apiv1/segments/addSegmentWithHashPOSTAdd a subscriber by subscriber hash
https://api.pushengage.com/apiv1/profilePOSTAdd or remove a subscriber by profile ID

All REST API calls require your API key in the Api-Key header. Profile IDs are a flexible identifier you assign to subscribers (for example, an email address or user ID) that let you manage the same subscriber across devices.

Example: Add a subscriber to a segment using a profile ID:

curl -X POST \
  -H "Api-Key: <your_pushengage_api_key>" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d 'segment_name=Recent+Buyers&profile_id=user123&operation=add' \
  "https://api.pushengage.com/apiv1/profile"

To remove the same subscriber from the segment, change operation=add to operation=delete.

See the full REST API Segment Reference for complete documentation.

Vanliga frågor

What is the difference between a static segment and a dynamic segment? A static segment keeps a subscriber in the group until you call a remove method. A dynamic segment expires automatically after the number of days you specify when adding the subscriber. Use static segments for permanent states like account type. Use dynamic segments for time-limited windows like a post-purchase period or a free trial.

Do I need to create a separate segment in the dashboard for dynamic use? No. Segments are created the same way in the dashboard regardless of how you add subscribers. The difference is only in which SDK method you call: addSegments adds permanently, and addDynamicSegments adds with an expiry.

The segment name I pass to the SDK is not matching. What should I check? Segment names are case-sensitive and must match the name in the PushEngage Dashboard exactly, including spacing and capitalization. Go to Audience » Segments to verify the exact name.

Can a subscriber belong to multiple segments at once? Yes. You can add a subscriber to as many segments as you need. When you send a campaign to a segment, all subscribers currently assigned to that segment receive it.

Can I use segments with Trigger Campaigns, not just Push Broadcasts? Yes. Segment targeting is available across Push Broadcasts, Drip Autoresponders, and Trigger Campaigns. The Audience section in each campaign type includes the option to target by segment.

Where can I view which subscribers are in a segment? Go to Audience » Segments in the dashboard and click on the segment name to see subscriber details and counts.

Om du stöter på några problem är du välkommen att kontakta oss genom att klicka här. Vårt supportteam kommer att kunna hjälpa dig.

Last updated on July 27th, 2026

Engagera och behåll besökare efter att de har lämnat din webbplats

Öka värdet av varje webbesök med push-notiser som är svåra att missa.

  • Evigt gratis-plan
  • Enkel installation
  • 5-stjärnig support