Segments

Cohorts or Groups of users based on data collected and sent to OneSignal.

Segments give you the ability to group and target users with more personalized and engaging messages. You can divide your subscriber base into specific audiences based on multiple filters of data like activity, country, language, Data Tags, etc.

Segments are updated automatically once created. As users interact with your app or website, they may be added-to or removed-from segments without any additional setup or tracking on your end.

Segments can be created through the OneSignal dashboard or Create segment API. This guide discusses how to create them through the dashboard.

πŸ“˜

Segments Count Opted-In Subscriptions

The counts you see are the number of subscribed or opted-in Push, SMS, and Email subscriptions.

Segments used for Journeys and In-app Messages will include the users and opted-out subscriptions.

There is currently not a way to get the counts of unsubscribed subscriptions with segments. Use the Export CSV of Players API to get this data.

Create Segments

In Audience > Segments select New Segment.

Add Filters

All possible filters shown in your dashboard may be combined to create specific segments. Not all platforms support each Filter Type and not all filters have the same options.

Select the Last Session filter for the last time a user visited your app or website.

Set this to be "greater than" 240 hours. This will tell us how many users have not returned to the site or app in over 10 days.

Filter Types

Understanding the data used to create segments.

FilterDescription
FIRST SESSIONMobile - The first date/time the user opened the app with OneSignal SDK active and valid network connection.
Web Push - The first date/time the user subscribed to your site.
LAST SESSIONThe most recent date/time the user's device communicated with OneSignal servers. Updated when device opens the app on mobile or subscriber returns to the site and attempted to update again upon leaving the app / website. Does not update when app is in the background.
SESSION COUNTMobile- The number of times the user's device has opened your app.
Web Push - The number of times the user visited your website after not having the website open previously.
USAGE DURATIONThe total number of seconds the subscription has had your app open.
AMOUNT SPENTThe amount the user has spent on "Consumable" In-App Purchases.
iOS, Android, Amazon - this data is available without additional work. See What kind of in-app Purchases are tracked.
Web Push - you must integrate in-app purchase as Data Tags and filter based on tag.
PURCHASED ITEMFilter by code of In-App Purchase item.
iOS, Android, Amazon - this data is available without additional work. See What kind of in-app Purchases are tracked.
Web Push - you must integrate in-app purchase as Data Tags and filter based on tag.
LANGUAGEUser's preferred language. See Language & Localization for possible codes.
APP VERSIONVersion of your app gathered from Android Studio versionCode in your App build.gradle and iOS uses Identity Version or CFBundleShortVersionString in Xcode.
DEVICE TYPEDevice operating system: Google Android, Huawei Android, iOS, Windows Phone, Chrome, Firefox, Safari, or Email
USER TAGRequires Data - Tags you have added to the user. See Data & Tags for more details.
LOCATIONRequires Data - Radius in meters from a particular geocoordinate (lat, long).
ROOTEDAndroid - whether devices is rooted.
COUNTRYThe ISO 3166-2 country code of the IP address detected on the user's device the last time it communicated with OneSignal servers.
TEST USERSIncludes all test users that you have set up as a Test User.

AND Clauses

After adding your first filter, the Add filter button will create an "AND clause" which requires all users to fit into all filters combined with "AND clauses".

Under "Last Session" select Add filter and select Last Session again.

Set this to be "less than" 264 hours.

When a user has not visited the site in over 240 hours (10 days) they will enter into this segment AND after 264 hours (11 days) they will be moved out of this segment.

OR Clauses

To combine multiple filters that do not depend on each other, click Add Or to separate groups of filters.

Select Add Or and select First Session "greater than" 72 hours.

Now, the segment contains all users that "First Subscribed" over 72 hours ago (3 days) OR users that have not been back to the site in over exactly 10 days.

Name the segment something memorable like 10 Days Inactive Or Over 3 Days New and select Create Segment.

Delete Filters

Simply click on the 'X' next to a filter to delete it from a segment. Note that any time a filter is added or deleted, the audience count is updated.


Segment Options

Select the Options button next to the segment to do the following:

View users

Navigates to the Audience > Subscriptions page to view the user subscriptions contained in the segment.

Edit

Opens the segment editor. Same as clicking the segment directly.

Pause & Resume

Depending on your plan type you can pause segments to create more. If a segment is paused when trying to target it, the notification will fail.

Set as Default

The OneSignal Dashboard defaults to the "Subscribed Users" segment when sending messages. This can be changed by setting a "default segment".

A "default segment" will be the first segment selected when creating a message within the OneSignal Dashboard. This is to help both quickly target certain segments used frequently and help prevent mistakes if the segment is not changed before sending the message.

Duplicate

Creates a copy of the segment filters.

Delete

Deleting segments from Audience > Segments or using the Delete segment API does not delete the users within the segment. It just deletes the segment from the view. To delete users within a segment permanently, see Delete Users.


FAQ

Are segment counts accurate?

Once you reach over 100,000 Total Users, segment counts begin to be estimated in order to keep the dashboard running quickly and smoothly. To get the most accurate numbers, see the Delivery stats for the message sent to that segment.

What kind of in-app purchases are tracked and how can I import historical in-app purchases?

The OneSignal mobile SDKs will automatically track "Consumable" in-app purchases made while the OneSignal SDK is active in the app. Subscription based in-app purchases are not tracked.

To update a device's previously bought in-app purchases before the OneSignal SDK was added, use the Update user API to update the purchases parameter.


What’s Next