HTML Prompt

Allow users to express their interest in notifications prior to registration.

This plugin provides a utility that allows users to express their interest in receiving notifications prior to registering their channel.

It is a best practice to explain the value of your notifications before prompting the opt-in flow. Using a soft prompt also gives users the chance to politely decline for now, without setting the browser permission to denied, giving you the chance to request again at a later time.

Two HTML prompt templates are available:

TemplateDescriptionExample image
AlertA basic alert, with configurable title, message, logo, and button fields
BellA small bell that stays fixed on the page

Loading the Plugin

The URL will differ depending on whether you are using our North America or EU data center:

Data center locationURL
North Americahttps://aswpsdkus.com/notify/v2/ua-html-prompt.min.js
EUhttps://aswpsdkeu.com/notify/v2/ua-html-prompt.min.js
Loading the HTML Prompt Plugin (US Data Center)
UA.then(sdk => {
  sdk.plugins.load(
    // globally unique plugin identifier; we always use `html-prompt`
    'html-prompt',
    // URL to the html-prompt script; this example is for the US data center
    'https://aswpsdkus.com/notify/v2/ua-html-prompt.min.js',
    // options passed to the plugin
    {type: 'alert'}
  )
})

See below for the full list of options you may use when loading the plugin.

Options

Options for the alert and bell templates:

KeyTypeDescriptionDefault value
typestringTemplate to use, one of alert or bell.alert
appearDelaynumberDelay, in milliseconds, before displaying the prompt. Useful when auto is set to true.0
disappearDelaynumberDelay, in milliseconds, before the prompt automatically disappears0
askAgainDelaynumberDelay, in seconds, before prompting user again after dismissing or ignoring the prompt1209600 (2 weeks)
stylesheetstringCSS Stylesheet URL to customize the prompt appearancenull
autobooleanControls automatically displaying the prompt on page loadfalse
UAstringUA global variable used in your SDK snippet. Only use if you have overridden the default global variable.UA

Options for the alert template only:

KeyTypeDescriptionDefault value
positionstringThe position of the alert on the webpage, one of top or bottomtop
i18n.{lang}.titlestringAlert title'Subscribe to our notifications'
i18n.{lang}.messagestringAlert messageen: 'Stay tuned and get our best offers by subscribing to our push notifications.'
i18n.{lang}.acceptstringLabel for Accept buttonen: 'Yes, Subscribe me!'
i18n.{lang}.denystringLabel for Deny buttonen: 'No thanks'
logostringLogo URL to be displayed in the alertnull

Option for the bell template only:

KeyTypeDescriptionDefault value
positionstringThe position of the alert on the webpage, one of top-left, top-right, bottom-left, or bottom-rightbottom-left

Methods

Use .prompt(options = {}) to trigger the display of the HTML prompt. More options can be passed into this method to override the ones passed when loading the plugin.

UA.then(sdk => {
  sdk.plugins.load(
    'html-prompt',
    'https://aswpsdkus.com/notify/v2/ua-html-prompt.min.js',
    {
      stylesheet: 'https://my.domain/path/to/some.css',
      askAgainDelay: 3600
    }
  )
    .then(plugin => plugin.prompt())
});