Skip to main content
When a user taps a notification, you can route them to a specific page, pass custom data to trigger JavaScript logic, or combine both. This guide covers the two main patterns and the key distinction that trips most developers up.

How it works

Notifications can include additional data. If you’ve included a targetUrl in the notification data, the app navigates to that URL. If you’ve included custom key-value pairs, it calls your JavaScript handler function with that data. You configure both of these in the Additional Data section of any notification, whether you’re sending from the OneSignal dashboard or the REST API.

Notification tap decision flow

Handling notification taps (deep linking)

To deep-link a user to a specific page when they tap a notification, add targetUrl to the Additional Data section of your notification:
Additional Data section of the OneSignal notification composer with a targetUrl key

Add Additional Data to send to your app

Note: targetUrl is a reserved key. As soon as Median sees it in the payload, it navigates the app to that URL automatically.

targetUrl vs. launch URL

OneSignal has two different URL fields, and they behave very differently: Always use targetUrl in Additional Data for deep-linking. The Launch URL field is designed for opening external web pages in a browser-like pop-up; it doesn’t support in-app navigation features, JavaScript Bridge calls, or native plugin interactions.

Sending custom data to JavaScript

Separately from navigation, you can attach any custom key-value pairs to Additional Data and read them in JavaScript once the notification is tapped and the app opens. This is the mechanism to use when the tap needs to trigger app logic rather than (or in addition to) a page change. For example, updating app state, firing an analytics event, or pre-filling a search based on the notification content. Define a handler function on your page. Median calls it automatically when a notification is opened:

Combining navigation and data

A single notification tap can both navigate and trigger your handler. Include targetUrl alongside your custom keys in Additional Data:
Median navigates to targetUrl first, then calls median_onesignal_push_opened with the full data payload so your page can react after the navigation completes.

Frequently asked questions

No. targetUrl is handled natively by Median and the app navigates automatically.
Median navigates to targetUrl and then calls median_onesignal_push_opened with the complete payload.
Launch URL opens in a separate popup browser window without JavaScript Bridge or native plugin access. For in-app navigation, use targetUrl in Additional Data instead.
targetUrl is a reserved key in Additional Data. Including it automatically triggers in-app URL navigation when the notification is tapped. If you want to conditionally navigate to a URL based on your own JavaScript logic instead, use a different key name (for example, openUrl or deepLink) and handle the navigation yourself inside median_onesignal_push_opened.
Last modified on November 7, 2026