OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Message Personalization

Concepts - Ways to personalize messages to individual users

Personalizing notifications helps users connect more with your app and website. Common examples are putting the person's name or abandoned cart item in the notification title, message or image.

There are generally 2 ways to go about this:

  1. Using OneSignal's Data Tags for Tag Substitution within the email and notification Title, Message, Launch URL and image.
  2. Tracking the User ID through your CRM or Database and targeting the device directly with custom messages. See our Internal Database, DMP, & CRM for more on how to set this up.

Tag & Variable Substitution

Notification contents such as message body, title, subtitle, launch URL, and image support place holders inline. They can be substituted with tag values for each user. These can be set on the device record with the sendTag(s) functions on our SDKs.

Let says for example you want to send a notification with their name and current stage they are on in your game. Example:
Hello Josh! We just improved our controls, come back and see if you can beat level 10!

Add {{ tag_key | default: 'default_value' }} inline with your message text. Replacing tag_key with your own key, as well as the required default value. Example let say you have the following 3 users.
User 1: tags: {name: "Josh", current_stage: 10}
User 2: tags: {name: "George", current_stage: 9}
User 3: tags: {}

Send a notification with the following contents:

Hello {{ name | default: 'there'}}!
We just improved our controls, come back and see if you can beat level {{ current_stage | default: '1' }}!

This will result in the following notifications going out to each user.

User 1Hello Josh! We just improved our controls, come back and see if you can beat level 10!
User 2Hello George! We just improved our controls, come back and see if you can beat level 9!
User 3Hello there! We just improved our controls, come back and see if you can beat level 1!

Launch URL Substitution

You can add tag substitution into the Launch URL (and associated web URL and app URL) of the push. You should not include the http:// or https:// protocol in the tag. Also not recommended to include the site origin. It is recommended to only tag the path of the URL the user should go to.

For example, let's say you want to send the user to an abandoned cart page: https://myshop.com/cart/jonf867 where jonf867 is my "cart id"

You would tag the user with OneSignal.sendTag("cart_id", "jonf867");

Then set the Launch URL to be: https://myshop.com/cart/{{cart_id}} the cart_id tag key will be replaced with the tag value when clicked by the user.

Another example we share is to Auto-Segment By Subscription Page where you tag the user with the sub_page : pathname which is the path of the subscription page which the user subscribed.

For instance, if I subscribed on https://yoursite.com/finance/tesla-soars-today, my device will be tagged with sub_page : /tesla-soars-today

You can reference this in the Launch URL by adding: https://yoursite.com{{sub_page}} because the tag already contains "/". If the tag does not contain "/" make sure you add it.

You can always test your implementation by setting yourself as a test user. See Find Devices & Set Test Users more details.

Image Substitution

A common example for Abandoned Cart is to add the last item set to the cart's image in the push. You can simply tag the user with a key like "cart_image" and the value is the full URL to the image.

Then in the Dashboard Image field or API Image parameters, you can set the tag key surrounded by curly brackets {{cart_image}} and/or add a default image
{{cart_image | default: 'https://cdn.pixabay.com/photo/2016/03/27/19/33/sunset-1283872_960_720.jpg'}}

In addition to the main notification image, you can also use tag substitution for images and icons for different platforms under platform settings.


Target Directly by User Id

You can detect the User Id and target the device directly with custom push message. You can use the OneSignal Player ID or your own External User Id.

For integrating your CRM or Database see the Internal Database, DMP, & CRM Guide.

Also more details on this in our Transactional Messages Guide.

Updated 14 days ago



Message Personalization


Concepts - Ways to personalize messages to individual users

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.