How can i use onesignal in blogger?


#1

i was looking for service for push notifiaction then i found onesignal.com service.

i want onesignal for notifications in blogger? the problem facing me that i can’t see the notification button in my blog. onesignal.com. Post must be at least 280 characters Have you tried the button?


#2

They must have given you some code to implement which you need to add in your blog template. You need to paste that code above </head> section of your template using template editor. :smile:


#3

You need to add the below JavaScript SDK into your blogger template,

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async='async'></script>
  <script>
    var OneSignal = window.OneSignal || [];
    OneSignal.push(["init", {
      appId: "YOUR_APP_ID",
      autoRegister: false, /* Set to true to automatically prompt visitors */
      subdomainName: 'SUBDOMAIN_NAME',   
      httpPermissionRequest: {
        enable: true
      },
      notifyButton: {
          enable: true /* Set to false to hide */
      }
    }]);
</script>

Customize:

  1. Replace YOUR_APP_ID with your app id.
  2. Replace SUBDOMAIN_NAME with your subdomain name.

Reference onesignal documentation (official) tutorial is here, click here