Setting Up Web Push Notifications on Your Website

šŸ“˜

Important

Web push token collection is only available for HTTPS protocol websites.

Selecting a Subscription Type

  1. Go to your account settings and select the Web Push tab.
Web Push settings page with the account dropdown menu open and Settings highlighted
  1. Select the subscription type:
  • Double Opt-in. A double opt-in subscription. The advantage of this type is the ability to customize the appearance of the subscription and confirmation windows. In this case, a user will first see your customized window, and then the standard one.
  • Single Opt-in. Allows users to subscribe with just one button click, without additional confirmation.
🚧

Note

Google Chrome may block intrusive subscription windows. To avoid potential limitations, select the Double Opt-in subscription.

Comparison of the Double Opt-In confirmation prompt and the Single Opt-In browser notification permission prompt

Click the +Connect website button, then select the subscription type if your account has existing subscriptions.

Web Push settings page with the Connect website button highlighted

New Website Adding

After selecting the subscription type, fill in the required fields Website URL and Website name.

New website adding form with the Website URL and Website name fields highlighted
šŸ“˜

Note

The Website name field can be used to create dynamic segments, as well as for searching and filtering contacts within a list.

We recommend using original website names for each site or subscription page — this will help you segment subscribers from different versions, even if they share the same domain.

Example:

  • sitename.com/en — My store EN (English website version)
  • sitename.com/ua — My store UA (Ukrainian website version)
Segmentation field list with website name channel options highlighted under Channels

Service Worker Setup

Service Worker is a script that runs in the background on your device, even when you are not using the website or application.

šŸ“˜

Note

A Web Push token is issued per browser (through the Service Worker), not per device. A person using several browsers on the same device generates a separate token in each one. Two browsers on one device therefore create two separate subscriptions, and both of them can receive the same push.

The browser does not have to be open for delivery — the Service Worker runs in the background wherever the operating system and the browser support it.

The Service Worker configuration includes three fields (filled in automatically):

  • Path to the file — the path to the directory on the website where the script file should be uploaded.
  • File name — the name of the file containing the code (will be generated in the Web Push Integration step.)
  • Scope — the scope within which the Service Worker can interact with the website content. It defines on which pages or in which directories of the website this Service Worker will be active.
ā—ļø

Important

  • When using a web push Service Worker together with a PWA (Progressive Web App) Service Worker, it is necessary to separate their scopes to avoid conflicts. A typical setup is to place the PWA Service Worker in the root directory of the website and the web push Service Worker in any other directory.
  • The scope of the web push Service Worker is not limited to the pages where the script is active. It works on all pages of your website, even if they are not within the specified scope.
Service Worker setup form showing the Path to the Service Worker file, Service Worker file name, and Service Worker scope fields

If you need to place the file in a different directory on the website, change the path to the Service Worker file.

šŸ“˜

Note

The file path and scope must have the same base path, starting and ending with a slash /. For example, if the path is /push/reteno/, then the scope must also start and end the same way, meaning it should also be /push/reteno/.

Web Push Certificates

If you already have a subscriber base, enter public and private keys in the corresponding fields. To receive new certificates, leave the fields blank—the keys will be automatically generated along with the script for your website.

Web push certificates form with empty Public key and Private key fields

Legacy Browsers Support

Follow the link to configure Web Push subscriptions on Safari versions below 16.

šŸ“˜

Note

Sending Web Push notifications in Safari is only available in the Advanced plan

Legacy browsers support section with Key ID, Signature key, and Certificate upload fields

Web Push Integration

It consists of the following steps:

  • Generating and integrating the script
  • Checking the website status

Let's take a closer look at these steps

Generating and Integrating the Script

Service Worker setup and Web push certificates form with the Generate script button highlighted

Click Generate script and follow these steps:

  1. Download the Service Worker installation file below and copy it to the /push/reteno/ directory on your website or to the directory specified in the File path field in the Service Worker settings.
  2. Copy the generated code and insert it into the <head> section of your website's HTML pages.
  3. Create a manifest file, place it on your site, and connect it on HTML pages to enable sending messages to devices with iOS/iPadOS.
Web push integration steps highlighting the Download installation file button and the generated script code to copy

Checking the Connection Status

After uploading the installation file and adding the code to your website, click the Check website status button.

Generated script code with the Check website status button highlighted

The Website connected status should appear in the settings. From this moment on, tokens will start to be collected.

šŸ“˜

Note

A new web push subscription is matched to an existing contact through a CustomerData event carrying externalCustomerId. If this event isn't sent right after the subscription is confirmed, the token attaches to a new (anonymous) contact instead of your existing one. See Setting Up Web Tracking for the event format.

The Web Push script itself does not accept externalCustomerId — you can't bind a subscription to an external identifier at the subscription step. To send a Web Push to a specific contact, use the Send prepared message (smartsend) resource with contactId: after the subscription, the contact ID is available in the browser's storage. The send works as long as the contact still has a valid web push token.

We don't recommend assigning externalCustomerId to contacts whose only channel is a web push token: the token is unstable and can become invalid, and a contact left without any media channel is deleted automatically. The external identifier stays attached to that deleted contact and can no longer be assigned to another one.

Website connected success message stating tokens are being collected and Web Push is enabled

Check the settings you’ve made if you see Script not installed.

Script not installed error message instructing to copy the generated code into the HTML head section
ā—ļø

Note

Sometimes, the website status may not be displayed due to the website provider’s security policy. If the script is installed, ignore this status.

The Script not installed warning can also be a false positive when the script is added through Google Tag Manager — the subscription can work correctly despite the warning.

Judge by the actual signals instead: the script loads (visible in the browser's Network tab), the Service Worker is registered, the browser shows the permission prompt and the subscription succeeds, and the subscriber base grows. Only if the functionality genuinely fails should you look for an sw.js / PWA Service Worker conflict or for errors in the Console and Network tabs.

Web Push Support on iOS/iPadOS in PWA

To enable Web Push notifications support on iOS/iPadOS devices in PWA (Progressive Web Apps), make sure that:

  • the manifest file is placed on your website and available to the browser;
  • the manifest is connected on the website's HTML pages in the <head> section, for example: <link rel="manifest" href="/manifest.json">;
  • the manifest contains "display": "standalone" or "display": "fullscreen". If display is not specified, the browser uses browser by default, and Web Push on iOS/iPadOS may not work;
  • if the app should open from the website's home page, specify "start_url": "/" in the manifest.

Placing the manifest in the root directory is not required.

Website connected message with a Manifest not found warning about enabling web push on iOS/iPadOS PWAs
šŸ“˜

Note

If Web Push on iOS/iPadOS in PWA is not required, you can ignore the Manifest not found status.

Users can unsubscribe from web push in PWA through the browser/device notification settings or directly from a received push notification. A separate unsubscribe option inside the PWA itself is not required.

Click Set up subscription to go to the appearance settings of the subscription window, or Back to return to the general settings tab.

Website connected message with the Set up subscription button highlighted

Learn more about customizing the appearance of the subscription window in a separate article.

Deleting Tokens

Enable the option to automatically delete inactive tokens after 30, 60, or 90 days to keep only those users who interact with the campaigns.

šŸ“˜

Note

A web push token is linked to a specific browser through its Service Worker, not to the device as a whole. The same user can therefore have several tokens on one device if they subscribed from different browsers.

Two browsers on one device create two separate subscriptions, and a push notification can arrive in both.

The browser does not have to be open for a message to be delivered: Service Worker runs in the background where the operating system and browser support it.

Web Push settings page with the delete inactive tokens toggle and the 30/60/90-day dropdown highlighted

Editing Web Push Integration

To return to the integration settings, for example, to change the website name, re-upload the installation file, or copy the generated code, click the website link or the three dots icon and select Web Push integration.

Editing Web Push Integration

In the same menu, you can delete or temporarily deactivate/reactivate the linked site.

If the site is deactivated, collecting subscribers for it is suspended and sending messages is impossible.

After activation, all functionality will become available again, all contacts will remain subscribed and with active tokens.

When you delete a site, all web push tokens collected on the site are deleted along with it.

šŸ“˜

Note

  • To link a site, you can use the API resource Add web push domain.
  • A site linked via the API is inactive by default — it must be activated manually.

Did this page help you?