Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.47 KB

File metadata and controls

47 lines (31 loc) · 1.47 KB

WonderPush Web SDK plugin to present the user with a switch she can use to opt-in or opt-out to push notifications.

Here is a screenshot of the default switch shown to the user with the wording proposed in the doc:

![Screenshot of the plugin switch](screenshot.png)

You can place it anywhere you see fit in your page.

How to use this plugin

From the WonderPush dashboard

Log in to your WonderPush dashboard and head over to the Settings / Configuration page in the left menu. Select the Website tab and use this plugin.

From the initialization options of the SDK

Change your call to WonderPush.init() to include the following, merging existing keys as necessary:

WonderPush.init({
  plugins: {
    "optin-switch": {
      // Add any option to customize the plugin as desired
    },
  },
});

You can find the reference of the options in the {@link OptinSwitch.Options} section of the reference.

Placing the switch in your page

When loaded, the plugin looks for placeholder elements like the following, and fleshes them out to a beautiful switch:

<div class="wonderpush-subscription-switch"></div>

Reference

The available options are described in the {@link OptinSwitch.Options} section of the reference.

The available API is described on the {@link OptinSwitch} class. You can also use the data attributes on the placeholder instead of the plugin's options to control its appearance.