en:how_to_generate_web_push_opt_ins

This is an old revision of the document!


How to generate web push opt-ins?

Web Push Notifications sind Nachrichten, die an den Web Browser zugestellt werden. Der Nutzer kann sich hierbei auf einer beliebigen Website befinden. Wenn der Web Browser zur Zeit der Zustellung geschlossen ist, wird die Notification beim nächsten Öffnen angezeigt. Nachfolgend finden Sie eine Anleitung, wie Sie Opt-Ins für Web Push Notifications generieren können.

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>
en/how_to_generate_web_push_opt_ins.1652362552.txt.gz · Last modified: 2022/05/12 15:35 by fw