The goal is to allow you to trigger an external window where users can opt into receiving push notifications, on a separate and unique domain name. Once the user grants or denies permission, the opt-in window is automatically closed so the user can continue browsing the original website.

Awesome! How does it work?

Execute this JavaScript snippet when you want to trigger the opt-in window. This can be when the user clicks a button, submits a form, or responds to a survey question. Any place where you can conveniently execute JavaScript code.

var optinWindow = window.open('https://yoursupersamples.com/subscribe/');

Why is this necessary?

As a security measure, browsers will only allow you to close a window via JavaScript if that window was opened via JavaScript, therefore we must open the window with JavaScript so we can conveniently close it after the user grants or denies permission. This allows you to build a subscriber list, while allowing your users to get back to browsing content on your website.