Inhaltsverzeichnis

How do I generate web-push opt-ins?

Web-push notifications are messages that are delivered to the web browser. The user can be on any website. If the web browser is closed at the time of delivery, the notification will be displayed the next time it is opened. Below you will find instructions on how to generate opt-ins for web push notifications.

Opt-in generating for Web-Push – first steps

Upload SDK files

You will receive your personal SDK file from promio.net.

The following three files are included:

  1. manifest.json
  2. OneSignalSDKWorker.js
  3. OneSignalSDKUpdaterWorker.js

Include them on your main page (top-level domain). The URLs of the uploaded files should then look like this:

Insert the code

To collect web push opt-ins on your website, you need to insert a code into the <head> of your page. The code will be given to you by promio.net.

Your code will be personalized. The example below serves as an illustration.

<html>
<head>
 <link rel="manifest" href="./manifest.json"/>
 <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
 <script src="https://api.promio-connect.com/sdks/webpush.js" async=""></script>
 <script>
 var OneSignal = window.OneSignal || [];
 var promio = window.promio || [];
 OneSignal.push( function () {
 promio.push( function () {
 promio = new promio.WebPush();
 OneSignal.init( {
 appId: "{onesignalAppId}",
 notifyButton: {
 enable: true,
 },
 } );
 promio.init( {
 senderId: "SENDER_ID",
autoRegister: false
 } );
 promio.identifyUserByMail("foo@bar.de");
 promio.initSubscription();
 } );
 } );
 </script>
</head>
</html>