URLs, Links and Deep Links

This guide explains how to setup linking within your messages.

Linking with Push Notifications

When sending push, you have the option to set your links within the Launch URL or within Additional Data. For setting up deep links, see Deep Linking.

Launch URL

The Launch URL will direct the user to the default browser when the push is clicked. The URL should use https://.

If using deep links or a custom URI like your-app://, then launch URL may have unexpected results. See our Deep Linking docs for details.

If you have both web and mobile push subscriptions, then you can set different URLs if sending to an audience of both web and mobile app users. When using our Create notification API use the url property or the web_url and app_url properties.

Example showing OneSignal Dashboard New Push Message Launch URL options.

Example showing OneSignal Dashboard New Push Message Launch URL options.


Additional Data

Using Additional Data or the API data property, you can pass JSON data into the notification and handle it programmatically within the SDK Notification Click Listener and the additionalData property.



Linking with Email

You can add http:// and https:// URLs in your emails and have those links tracked or not.

Tracking email link click events requires changing the URL structure to capture the event, then redirect back to the original URL you set. This redirection happens very quickly and generally goes unnoticed. However, if you plan to add deep links to emails, it may have unexpected behavior. See Deep Linking for details.

By default, all emails sent from OneSignal will have link tracking enabled, causing this URL structure change.

You can disable link tracking by unchecking the Track link clicks option in the dashboard email form. For Emails sent through our API set disable_email_click_tracking to true in your API requests.

Track link clicks is enabled. Uncheck this box to disable link tracking.

Track link clicks is disabled.

If you disable link tracking:

  • OneSignal cannot track link clicks and will show N/A in the Email Message Reports Click-Through Rate.
  • All URLs in the email will not be tracked. There is not an option to disable link tracking for only specific links.

Deep Linking with Email

See Deep Linking for details.

Email Unique Link Tracking

To accomplish unique link tracking you can add UTM's directly to your emails. This will allow you to identify which links were clicked in an email.

Email Unsubscribe Links

See Unsubscribe Links & Email Subscriptions for details.


Linking with In-App Messages

In-app message image, button, and background elements have URL In-App Click Actions and HTML in-app messages have the openUrl method in the In-App JS Library.

Depending on how how you setup the links, you can deep link into the app following the Deep Linking guide.


Linking with SMS

You can send URLs within SMS messages. Shortening those URLs is also recommended. However, using public URL shorteners like TinyUrl or Bitly have been forbidden by many carriers due to bad actors. If you want to send shortened URLs, it is recommended to use your own dedicated short domain. More details.


Dynamic URLs

Variables can be included in your URLs via liquid syntax. See Custom URLs for details.


UTM Parameters

See our guide on UTM Parameters for details.


FAQ

How can I link to 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 - get the link to the app store page, but replace https:// with itms-apps://.

Can I link to another app?

For push and in-app messages, 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

For email and sms, you will need to use the https:// app store link.

Can I prevent linking to my app or site?

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.