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.
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.
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.
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>
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.