URLs, Links and Deep Links
Linking to internal and external URIs
This guide explains how to open to a specific page of your app or website using push notifications. For options using Email or SMS, please go to Email Links and Click Tracking or Sending SMS Messages.
Launch URL
The Launch URL or url
property on our API should be an https://
URL that opens a webpage or a custom URI like your-app://
that your app is setup to detect and handle programmatically usually through:
If you are sending to both a website and mobile app subscriptions, you can set a different URL for web and mobile app with the web_url
and app_url
parameters on the dashboard or API.
Default Processing of Launch URL
Sending a Launch URL with https://
links will have the following behavior. Note that Apple requires HTTPS URLs for iOS unless you update the App Transparency Security Settings.
Platform | Default Behavior |
---|---|
Android | Will prompt to open default browser. |
iOS | Will open default browser. |
Web | Will link the user to the URL upon push click. More details in Advanced Notification Options |
Suppressing Launch URLs
This section discusses how to prevent the Launch URL from opening a browser. If you want to keep this functionality, then see below Deep Linking with Additional Data instead.
Native Android SDK version 4.2.0+, in AndroidManifest.xml
add com.onesignal.suppressLaunchURLs
.
Setting the value to true
will not launch the url in a browser. Allows you to handle programmatically.
Setting the value to false
will launch the url in a browser.
<meta-data android:name="com.onesignal.suppressLaunchURLs" android:value="true"/>
Native iOS SDK version 3.2.1+, in Info.plist
add OneSignal_suppress_launch_urls
.
Setting the value to true
will not launch the url in a browser. Allows you to handle programmatically.
Setting the value to false
will launch the url in a browser.
<key>OneSignal_suppress_launch_urls</key>
<true/>
Deep Linking
Linking to specific pages of your app through push works best with a custom URI that your app is setup to detect and handle programmatically usually through iOS URL Schemes and Android Intent Filters. It is not recommended to use iOS Universal Links or Android App Links with push notifications.
It is recommended to create a custom scheme specific for your app like your-app-name://the-identifier-for-the-page-to-go-to
.
Deep Linking With Additional Data
Using Additional Data or the API data
parameter, you can pass some data into the notification and handle it programmatically within the SDK Notification Opened Handler and the additionalData
property.
Link into the app store
You can enter the store link as the launch URL. Examples:
Android - https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html
iOS - grab the link to the app store page, but replace https://
with itms-apps://
.
Link into another app
In most cases, you can setup a URL Scheme and deep link using the protocol x://
For example, deep linking into Whatsapp, you can use: whatsapp://wa.me/15551234567
Dynamic URLs
Variables can be set within the Launch URL through Data Tags. See Custom URLs for details.
No Linking
Currently on mobile apps, anytime the user clicks the push it will open the app.
Web Push: If you do not want to link to any page or url, you can add ?_osp=do_not_open
to the end of a URL like this https://yoursite.com/page?_osp=do_not_open
as the launch url, this will prevent the push from going to any url upon click and will just dismiss the push.
UTM Parameters
See our guide on UTM Parameters for details.
Updated 3 days ago