For Advanced Users Only
You should only use custom code if you absolutely need it. Otherwise, we recommend most users set up web push with Web Push Typical Setup or the relevant website builder (e.g. Wordpress, Blogger), rather than custom code.
Recent Change: December 2017
Before December 2017, custom code was required to set up OneSignal. We began offering a dashboard-based configuration in December 2017, which simplifies the setup process and requires no coding. All OneSignal customers that set up web push before December 2017 have been migrated to the 'Custom Code' integration.
OneSignal supports sending web push notifications from a variety of different web technologies. Select Custom Code to continue:
Once you've selected Custom Code as your integration, you must fill out information about your site.
This must be the exact URL you see in the browser when you visit the site.
Most users just enter their base site URL for this field (e.g.
If your site is accessible from both www & non-www links (e.g.
www.example.com), please only enter the URL that you wish to send push notifications from. We recommend redirect traffic from one to the other (e.g. users that visit
example.com are redirected to
www.example.com), so that all your traffic only goes to one.
This feature is only for HTTPS sites and you do not select "My site is not fully HTTPS".
This allows users to automatically resubscribe upon returning to the site without being prompted if they clear their browser cache or if you are transferring to OneSignal from another push provider.
Enter a link to an icon file that is at least 80x80 pixels (Recommended size is 192x192). The file must be
Web Push works best with sites that fully support HTTPS, and we recommend using HTTPS for Web Push when possible. To determine if your site fully supports HTTPS, look for the following:
- Your site URL must begin with
https://, and display a green lock icon on the browser's address bar
- Your site must redirect all
https://requests. In other words, users accessing the site via HTTP will be redirected to the HTTPS version.
If your site does not fully support HTTPS, you should select 'My site is not fully HTTPS':
Once you've selected this, you will need to choose a unique label to be displayed in your notifications. For example, the below image shows notifications are coming from
Warning: You can only change your label if you have less than 100 web users. Once you have 100+ web users, this setting is disabled.
Next, you'll need to add the OneSignal SDK files to your site. To do so,
Download the OneSignal SDK files. (You can also download the files here).
Unzip the OneSignal SDK files. There should be two files:
Upload the OneSignal SDK files to the top-level root of your site directory, making them publicly accessible.
There are three ways you can upload files to your site:
- Use an FTP Server like FileZilla to upload the files to your root directory
- Here is a great step-by-step guide.
- Use your hosting provider's control panel like cPanel to upload files.
- Most hosting providers will be more than happy to assist you in uploading files to your site.
- Just send them the zip file above and ask them to unzip it in your site's root directory.
Once you've uploaded the OneSignal SDK files, the following URLs should be publicly accessible (replace yoursite.com with your site's domain):
All code must be placed inside your website's
<head>. If you do not have access to modify your site's code, you will need to contact a developer to help you. ]
Next step: Send your first push notification via the OneSignal Dashboard