Appearance
Push notifications
Push notifications allow users to get informed about new questions and upcoming challenges even if they are not browsing your page or they aren't using their device at this moment.
By default push notifications are disabled - explore this chapter to learn how to enable them.
Setup
Setting up push notifications consists of two steps:
- Placing our service worker on your website
- Embedding widget with push notifications enabled
Placing our service worker on your website
Copy content of statscore-pip-notifications-sw.js script and place it in the root of your website (eg. if your domain is https://example.com then script should be placed at https://example.com/statscore-pip-notifications-sw.js). The script MUST be named statscore-pip-notifications-sw.js
Embedding widget with push notifications enabled
Simply pass pushNotifications: { enabled: true } option when embedding the widget.
WARNING
Since embedding widget with disabled notifications unregisters service worker, every embed on your website should have notifications either enabled or disabled.
Limitations
- Push notifications won't work in embedded environment (eg. WebView) - they need real browser to work. You should't enable them in that case!
- For mobile devices only android devices are supported
- For desktop major browsers including chrome, firefox and safari are supported
- Push notifications require secure context (https)