Setting Up Push Notification Personalization in Mobile Apps
A notification "Hi, {{name}}!" — that's not personalization. Real personalization is when the user gets a message about a discount on exactly the product category they browsed three days ago, at the time of day they usually open the app. Let's break down how this is implemented technically.
Dynamic Variables in Payload
Any serious platform — OneSignal, Braze, CleverTap, Firebase + custom backend — supports templates with variables. The server-side renders the final text before sending.
In OneSignal this looks like at API level:
{
"app_id": "YOUR_APP_ID",
"include_aliases": { "external_id": ["user_88234"] },
"headings": { "ru": "{{first_name}}, ваш избранный товар подешевел" },
"contents": { "ru": "{{product_name}} теперь стоит {{new_price}} ₴ — на {{discount_percent}}% меньше" },
"data": { "product_id": "{{product_id}}", "screen": "product_detail" }
}
Variable values are taken from user tags in OneSignal or passed in substitutions when sending via API. The first_name tag must be set in advance on the client:
OneSignal.User.addTag("first_name", user.firstName)
OneSignal.User.addTag("preferred_category", user.topCategory)
Personalization Based on Behavior
This is more complex — requires an analytics layer on the backend. Typical flow:
- Client logs events (product view, wishlist add, category).
- Backend or ML-service forms recommendations for the user.
- When sending notification, payload is enriched with recommended content.
If you don't have your own recommendation engine — you can use Firebase Personalization (ML-based optimization of A/B test content) or Braze Recommendations, which build a model based on SDK event history.
// Log behavior through Firebase Analytics
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM) {
param(FirebaseAnalytics.Param.ITEM_ID, product.id)
param(FirebaseAnalytics.Param.ITEM_CATEGORY, product.category)
param(FirebaseAnalytics.Param.PRICE, product.price)
}
Optimal Send Time (Intelligent Delivery)
OneSignal Intelligent Delivery and Braze Optimal Time track activity patterns for each user and delay delivery to the period of highest likelihood of opening. For one user it's 8 AM, for another — 11 PM.
Enabled with one parameter when sending:
{
"delayed_option": "last-active",
"delivery_time_of_day": "9:00AM"
}
last-active — deliver at the same time of day when the user was last active. This is not ML, but already better than batch sends at one time for everyone.
More precise option in OneSignal — intelligent_delivery: true. The platform itself chooses the window based on the specific user's open rate history.
A/B Testing
Without A/B, you can't claim that personalization works. OneSignal supports A/B tests natively:
{
"name": "price_drop_ab_test",
"messages": [
{
"variant_id": "A",
"contents": { "ru": "{{product_name}} подешевел на {{discount}}%" },
"weight": 50
},
{
"variant_id": "B",
"contents": { "ru": "Скидка {{discount}}% на товар из вашего вишлиста" },
"weight": 50
}
]
}
After the test completes, OneSignal shows CTR for each variant. The winning variant is implemented in the template.
Tracking Conversions
Notification CTR is an intermediate metric. More important — did the user actually complete the action? For this, you need outcome events:
// In the notification open handler
OneSignal.Notifications.addClickListener { event ->
val productId = event.notification.additionalData?.getString("product_id")
// User navigated to product
OneSignal.Session.addOutcome("notification_click_to_product")
}
// After purchase completion (elsewhere in code)
OneSignal.Session.addOutcomeWithValue("purchase_from_notification", orderValue.toFloat())
This links the conversion to the specific notification even if several minutes pass between the click and purchase.
Timeframe
Implementing dynamic variables and templates, setting up Intelligent Delivery, integrating outcome events and basic A/B testing — 6–10 working days. If your own recommendation layer on backend or integration with external ML system is required — timelines are discussed separately.







