Sample Code for Onesignal Push Notifications Integration for Blogger Blogs

Here is the code you need to add before </head> in your blogger blog html if you want to integrate Onesignal web push notifications.

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

Enter your OneSignal appID in the code. You can click here to learn how to get the appID for your blog.

If you want the subscription bell to display on the right hand side, change ‘bottom-left’ to ‘bottom-right’.

If you want to add the push notifications to your WordPress blog, use the Onesignal WordPress plugin.

Thanks to @ibehone for recommending OneSignal.

sir i have an error how will i resolve this

What’s the error? and is your blog a blogger or hosted wordpress blog?

it is bloger

1 Like

Its Working Now Thank you sir.

1 Like

pls when you click on the icon on your blog and it brings out the “Subscribe to notification” if I click on it, will it bring out any other thing?

No it won’t bring out anything

Disclaimer : Every member of NetDivo forum is solely responsible for anything that he/she posts or uploads on this forum.
web stats