Collecting subscribers with Notix push service

For collecting push subscribers with Notix two bunches of code are required:

  • Small in-page script that should be inlined into your site HTML code
  • Service worker that should be located in the root of your site
Both these parts are called “tag“ in this documentation.

For collecting push subscribers to Notix you need to:

  1. Create a tag inside Notix SSP
  2. Download the service worker and upload it into your site as a file
  3. Copy the in-page script and paste it into your site

In-page script usually looks like this:

<script id="script">
    const s = document.createElement("script")
    s.src = ""
    s.onload = (sdk) => {
            appId: "200394c5ec50ea1028d4bf7465f5dda",
            step0: "usePrerequest",
            delay: 3,
            audiences: ["sport", "news"]
            skinName: "default",
            ext_id: "",
            categories: "{\"sport\":\"Sport events\", \"fresh_news\":\"Daily fresh news\"}"

All parameters that define tag behaviour are located inside sdk.startInstall({}) block. You can customize all of them yourself directly inside of your site, without changing anything inside the Notix SSP. Also you can change settings in SSP and override them directly inside of your site.

Tag parameters

  • appId [string]Only this setting should always be present in tag. Identifies your tag and users, subscribed with it. Without this, Notix can't identify your subscribers.
  • loadSettings [bool] – Settings that are not inlined to tag can be loaded from server. You should not change tags when you change some settings in Notix SSP. However all settings can be overridden in tag parameters, which have greater priority than settings from SSP. Default true.
  • step0 [string] – How to ask user for permissions to send push notifications. Following values supported:
    • usePrerequest – The first request window that is shown on the page. Native browser permission request is only shown if the user gave permission on the initial one.
    • skip – Display native browser permission request immediately
    • waitClick – Display native browser permission only after user clicks on page
    • waitUserActivity – Display native browser permission only after user interacts with page (click, button press)
  • delay [integer] – Defines how many seconds should pass after page loading and before requesting permission. Works if step0 == "usePrerequest" or step0 == "skip"
  • audiences [array of string] – This variable is defined by the site owner. Any strings can be passed into tag before user subscribes. After subscription these values can be used like targeting values for splitting all users into separate audiences.
  • prerequest [object] – Object for configuring not native permission request. Only available when step0 == "usePrerequest"
    • afterCloseDelay [integer] – Number in hours for minimum delay between asking user permissions using prerequest (not native) window.
    • frequency [integer] – How many times permission prompt can be shown to user, during capping hours. Works only with capping, alternative to afterCloseDelay.
    • capping [integer] – Interval in hours for frequency setting. Works only with frequency, alternative to afterCloseDelay. Example: frequency=3, capping=24 - Not more than 3 permission requests during 24 hours.
  • skinName [string] – How the permission request looks like. Only available when step0 == "usePrerequest"
    • default – Looks like native OS prompt.
    • lightbox – Lightbox located in the center of the screen.
    • categories – Allows you to perform some user segmentation during subscription process. For example to select interesting topics/categories of information that user wants to receive.
  • categories [string, serialized object] – Only available when skinName == "categories" Encoded JSON object with key-value pairs that allow to subscriber select some categories before subscription. These values are displayed inside permission prompt window and are selectable by user. Example: "{\"sport\":\"Sport events\", \"fresh_news\":\"Daily fresh news\"}"