Push notifications + deep linking
Deep-linked push notifications are significantly more effective than generic notifications. Instead of opening to the home screen, users land directly on the content you want them to see. Combine OneSignal's powerful push targeting with Redirectly's deep linking for engagement that converts.
Without deep linking
- Push notification: "New product launched!"
- User taps → Opens home screen
- User searches for product manually
- Many users give up before finding it
- Low conversion rate
With Redirectly deep linking
- Push notification: "New product launched!"
- User taps → Opens product detail page
- Immediate call-to-action visible
- Zero friction to purchase
- 3-5x higher conversion rate
Create deep-linked push notifications
In OneSignal, you can set launch URLs for push campaigns. Instead of using standard URLs, use Redirectly deep links to ensure users go to the right app screen.
Step 1: Generate Redirectly deep links
Create unique Redirectly links for each push campaign:
// Create links for your OneSignal campaigns
Campaign: "New Summer Collection"
Link: https://myapp.redirectly.app/product/summer-2024
Query: campaign=summer&source=onesignal&medium=push
Campaign: "Flash Sale"
Link: https://myapp.redirectly.app/sale
Query: campaign=flash_sale&source=onesignal&medium=push&discount_code=FLASH2024
Campaign: "Abandoned Cart Reminder"
Link: https://myapp.redirectly.app/cart
Query: campaign=abandoned_cart&source=onesignal&medium=push
Campaign: "Win 50% Off"
Link: https://myapp.redirectly.app/promotion/vip
Query: campaign=loyalty_50off&source=onesignal&medium=push
Step 2: Configure OneSignal campaign
In OneSignal, paste the Redirectly link as the launch URL:
OneSignal Campaign Settings:
Campaign Name: New Summer Collection
Message: Check out our new summer products!
Launch URL: https://myapp.redirectly.app/product/summer-2024?campaign=summer&source=onesignal&medium=push
OneSignal will handle routing the deep link when users tap the notification.
Handle deep links in your app
Your app must be configured to listen for deep links and route users appropriately when they tap a OneSignal push notification.
// lib/services/notification_service.dart
import 'package:onesignal_flutter/onesignal_flutter.dart'
import 'package:redirectly/redirectly.dart'
class NotificationService {
static Future<void> initialize(
String oneSignalAppId,
String redirectlyApiKey,
) async {
// Initialize OneSignal
OneSignal.initialize(oneSignalAppId)
// Initialize Redirectly
await Redirectly.initialize(apiKey: redirectlyApiKey)
// Handle notification opened (user taps push)
OneSignal.Notifications.addForegroundWillDisplayListener(
(OSNotificationReceivedEvent event) {
// Don't show notification if it has a launch URL
// (handled by deep linking)
event.notification.display = false
},
)
OneSignal.Notifications.addClickListener((event) {
final launchUrl = event.notification.launchUrl
if (launchUrl != null) {
// OneSignal handles the deep link navigation
print('Notification opened with launch URL: $launchUrl')
}
})
// Handle cold start deep links (app not running)
Redirectly.onDeepLink.listen((link) {
print('Deep link from notification: ${link.path}')
_handleDeepLink(link)
})
}
static Future<void> _handleDeepLink(
RedirectlyLink link,
) async {
// Track which campaign drove the tap
if (link.params['campaign'] != null) {
print('User tapped ${link.params['campaign']} campaign')
}
// Navigate based on the deep link
if (link.path == 'product/summer-2024') {
navigatorKey.currentState?.pushNamed('/product', arguments: {
'productId': 'summer-2024',
'campaign': link.params['campaign'],
})
} else if (link.path == 'sale') {
navigatorKey.currentState?.pushNamed('/sale')
} else if (link.path == 'cart') {
navigatorKey.currentState?.pushNamed('/cart')
}
}
}
Campaign ideas with deep linking
Product launches & updates
Send push notifications with deep links directly to the new feature or product page. Users see it immediately without searching.
Flash sales & promotions
Use Redirectly query parameters to pass discount codes or campaign IDs. When users tap the push, the discount is already available on the sale page.
Abandoned cart recovery
Deep link directly to the user's cart. Include a discount code as a parameter to incentivize completion.
Win-back campaigns
Target inactive users with deep links to new content or exclusive offers. They land exactly where you want them.
Referral rewards
Send push notifications to referrers when their friends sign up. Deep link to a rewards page with their bonus offer.
Event-triggered notifications
Use OneSignal's automation to send triggered pushes when users match certain criteria. Deep link to the most relevant content for that user.
Measure push campaign effectiveness
Track which push campaigns drive the most valuable actions. Use deep link parameters to attribute user behavior back to specific notifications.
// Track push-driven actions
Future<void> trackPurchaseFromPush(
String orderId,
double amount,
) async {
final link = await Redirectly.getInitialLink()
// Log event with campaign attribution
analytics.track(
'Purchase from Push',
properties: {
'order_id': orderId,
'amount': amount,
'push_campaign': link?.params['campaign'],
'push_source': 'onesignal',
},
)
// Update user properties
if (link != null) {
analytics.setUserProperties({
'push_campaign_convert': link.params['campaign'],
'last_push_interaction': 'purchase',
})
}
}
// Segment users by push engagement
// OneSignal segment: "Tapped summer campaign"
// → Users where push_campaign = "summer" and last_push_interaction = "purchase"
// → Measure LTV, repeat purchase rate, etc.
Next steps
Boost engagement with deep-linked OneSignal push campaigns: