OneSignal Management¶
Non-Visible componentCategory | Requires | Version |
---|---|---|
Social | API 21, Android 5.0 Lollipop | 1 |
Overview¶
The core OneSignal component for managing user identity, data, and privacy. Use it in addition to other OneSignal components to handle logins, set tags, manage subscriptions, and track outcomes.
Events¶
Error Occurred¶
Called when an error occurs.
Params | |
---|---|
message | Text |
Methods¶
Add Alias¶
Adds a new alias. Aliases are alternative identifiers (like usernames or CRM IDs). Set "externalId" with "Login" before adding aliases. Aliases added to subscriptions without external_id willnot sync across multiple subscriptions.
Params | |
---|---|
label | Text |
id | Text |
Add Email¶
Adds an email Subscription (email address) to the current user. Call AddEmail after Login to set the correct user context.
Params | |
---|---|
Text |
Add Outcome¶
Adds an outcome with the provided name, captured against the current session. An outcome track actions taken by users and attribute them to messages.
Params | |
---|---|
outcome | Text |
Add Outcome With Value¶
Adds an outcome with the provided name and value (number) captured against the current session.
Params | |
---|---|
outcome | Text |
value | Number |
Add SMS¶
Adds an SMS Subscription (phone number) to the current user. Requires E.164 format. Call AddSms after Login to set the correct user context.
Params | |
---|---|
phone | Text |
Add Tag¶
Adds a tag on the current user. Tags are custom key-value pairs of string data you set on users based on events or user properties.
Params | |
---|---|
key | Text |
value | Text |
Add Unique Outcome¶
Adds a unique outcome with the provided name, captured against the current session.
Params | |
---|---|
outcome | Text |
Get External ID¶
Returns: Text
Retrieve the current External ID. May be null if not set or called before user state is initialized.
Get One Signal ID¶
Returns: Text
Retrieve the current OneSignal ID. May be null if called before user state is initialized.
Get Tags¶
Returns: Dictionary
Returns all tags on the current user as a dictionary of their key-value pairs.
Is Consent Given¶
Returns: Boolean
Returns whether user consent for data collection is granted. Without consent, no data is sent to OneSignal and no subscription is created.
Login¶
Sets the user context to the provided "externalId". Ensures that all subscriptions and properties associated with this "externalId" are unified under a single OneSignal ID. If the "externalId" already exists, the SDK switches to that user. Anonymous data collected before login is not merged and will be discarded. If the "externalId" does not exist, the local state will be saved under the current OneSignal ID. Any data collected while the user was anonymous will be kept. SDK retries automatically on network failure or server error.
Params | |
---|---|
external ID | Text |
Logout¶
Unlinks the current user from the subscription. Removes the "externalId" from the current push subscription. Resets the OneSignal ID to a new anonymous user. Any new data (e.g tags, Subscriptions, session data, etc.) will now be set on the new anonymous user until they are identified with the login method.
Remove Alias¶
Removes an alias.
Params | |
---|---|
label | Text |
Remove Email¶
Removes an email Subscription from the current user.
Params | |
---|---|
Text |
Remove SMS¶
Removes an SMS Subscription from the current user.
Params | |
---|---|
phone | Text |
Remove Tag¶
Removes a tag.
Params | |
---|---|
key | Text |
Set Consent Given¶
Grants or revokes user consent for data collection. Without consent, no data is sent to OneSignal and no subscription is created.
Params | |
---|---|
given | Boolean |
Properties¶
Language¶
Text Write - Blocks
Overrides the auto-detected language of the user. Use ISO 639-1 language code.