Domain Management

Common questions about managing the domain for your web push setup.

How do I change my domain?

Browsers have setup web push in a way that ties subscribers to a specific origin (domain/site URL).

For security purposes and browser's same origin policy, browsers do not allow subscribers to be moved to other origins. This is not a OneSignal limitation, any claims that you can move subscribers from one site origin to another means the subscribers are not tied to your site origin.

Sites with different origins include:

  • Changing from HTTP to HTTPS
  • www.mysite.com and non-www version
  • domain1.com and domain2.com or sub.domain1.com and sub.domain2.com

If you changed your site origin, there are two options:

Option 1. Setup a new OneSignal App

Set up a new OneSignal app and have your users subscribe to the new site origin under this new OneSignal app. You will not able to import subscribers from one origin to another origin. You can continue sending push notifications to your subscribers on the old origin (old OneSignal app), but your users will need to re-subscribe to the new origin to get push from the new domain.

The recommended steps for migration are as follows:

  1. Setup a new OneSignal App ID for the new site domain.
  2. Continue to send push from the old OneSignal App with old site domain. In the "Launch URL" of the notifications, use the new site domain.
  3. After 2 weeks to 2 months (depending on how many notifications you send per day and how many subscribers you get on the new origin) you can then stop sending from the old OneSignal app and only use the new OneSignal app.
  • For example if you send 1+ notifications per day, then 2 weeks should be enough time to have your users subscribe to the new domain.
  • If you send 2+ notifications per week, then 2 months should be enough time.
  • If you send the same message from the old OneSignal App and new OneSignal app, any subscribers under both will get duplicate messages. This is why the timeframes are recommended.
  1. You can send a couple "We've moved, click here to visit our new site to subscribe again and stay updated" messages. This will help alert people that they may not get push from your site if they don't return to subscribe. Best to send this at the beginning of the move and last message sent from the app.

Unfortunately all websites and user-bases are different. Be prepared to lose subscribers in the short term.

Option 2. Update App API & Delete Users

You can use the Update an app API to change the site url with the following properties:

  • name - the name of your app or site
  • chrome_web_origin - the new site URL you want to change to.
  • chrome_web_default_notification_icon - the image URL of your icon.

Be aware that the subscribers under the "old" origin that is being replaced will get double notifications if they subscribe to the "new" origin. This is because the subscription push token is tied to the site origin and you may now get 2 different origin push tokens for the same user.

To get around this, we recommend deleting all the "old" web push subscribers. You can use "Device Type is Web Push" for the segment and then Delete Users within the segment.

Can I setup multiple websites or subdomains with a single OneSignal App?

Browsers have implemented web push in a way that works best with only one main origin (domain/site url). Separate origins of a site cannot be merged to one app.

For example, browsers will not allow https://mysite.com and https://www.mysite.com to both collect the same subscribers.

Due to this browser limitation, it is not possible to unify multiple origins into a single OneSignal App. This can cause issues with duplicate notifications, and a poor user experience.

Generally, your options are:

  1. Only subscribe users on one origin. If you have subdomains or landing pages or any other sites using multiple origins, you can redirect users to the "main" origin to subscribe, then redirect them back to the other origin to continue browsing.

  2. Create separate OneSignal Apps for separate origins. Notifications will arrive independently of each other. This means users who subscribe to multiple sites will receive duplicate notifications if you send the same notifications on all sites.

More details in our guide for setting up Complex Web Push Integrations.


What should I do if I upgraded my site to HTTPS?

Browsers require 2 things for web push notifications to work:

  1. An HTTPS site
  2. Service worker files added to the server

If you had an HTTP site, and upgraded to HTTPS (or, you are now able to add service workers to your site), browser's will treat the HTTPS site as a new origin.

Please see How do I change my Domain for details.


Can I transfer subscribers from one site to another?

If you changed your site's origin, your users will need to subscribe to that new site origin. See How do I change my Domain for more details.


What if my site supports multiple languages?

If your site supports multiple languages through a subdirectory like: https://mysite/com/en_us/ or https://mysite.com/other-language/ then you have the same origin (https://mysite.com) and you can setup multiple languages on prompts following our Prompting FAQ to translate prompts and send push in different languages following Language & Localization.

If your site supports multiple languages through a subdomain like: https://en.mysite.com, then this would be separate origins and would require multiple OneSignal Apps. Each origin will need it's own OneSignal App Id.


Can I have multiple OneSignal Apps for the same site?

You can have multiple OneSignal App IDs on a single origin, but it is not recommended.

Each OneSignal App creates unique VAPID keys for the Site Origin attached to that App ID. VAPID keys facilitate the subscription process to the subscriber's browser and your site origin.

If you add multiple App IDs to the same site origin, OneSignal will auto-resubscribe the user to the last visited App ID. So you will see subscribers bounce back and forth between App IDs if they are able to visit pages with different App IDs.

For example, if you subscribed to https://yoursite.com/home using "App_ID_1", then visit https://yoursite.com/shop using "App_ID_2", OneSignal will unsubscribe you from "App_ID_1" and then auto-subscribe them to "App_ID_2".

You will see many unsubscribed devices on each app, as users bounce between them.

The recommended approach is to Add Data Tags to devices in order to differentiate them based on URLs.


What if my site is in a subfolder?

Web push is configured at the origin level.

If your site is hosted in a subfolder, like https://example.com/blog (where blog is the subfolder), your web push domain will be https://example.com. Continue the setup process with your main site origin. If you must add the service workers to the subfolder see Customizing Your Service Worker Integration.

Can OneSignal SDK files be served from a subfolder of my site?

Yes, please see OneSignal Service Worker guide for more details.


Why does my site require a label?

The Web Push Standard adopted by all major web browsers requires notifications from an HTTPS domain with technologies that support web push (specifically, the ability to upload files to the root directory).


Why do you require a label for my website builder?

Several website builders must the OneSignal HTTP SDK that requires a label, because these technologies do not allow files to be uploaded to the root directory. These site builders include:

  • Blogger
  • Shopify
  • Squarespace
  • Weebly
  • Some Wordpress implementations
  • Some Drupal implementations
  • Some Joomla implementations
  • Some Magento implementations

Why can't I change my site's label?

OneSignal allows you to experiment with different labels when you have fewer than 100 web subscribers to give you some extra flexibility while you're still deciding how to use push notifications.

After your app has 100+ web subscribers, this setting is disabled, and you must start over with a new OneSignal app to use a different label.

We do this because changing your label can cause subscribers to receive duplicate notifications.