FAQ About Web Push Integration and Service Worker
  • 24 Oct 2023
  • 2 Minutes to read

    FAQ About Web Push Integration and Service Worker


      Article Summary

      Is it possible to add Insider service worker in another folder other than the root folder of the website?

      Yes, a custom path for the service worker can be configured from the panel. It can be added into another folder as long as the folder is on the website domain and the service worker is accessible as www.yourwebsite.com/subfolder/insider-sw-sdk.js.

      Can we export tokens/users/subscribers collected by Insider?

      If you are using your own GCM/FCM project key and using native opt-in or custom opt-in with your own domain, then we can share a database export of their tokens. However, if you are using our shared GCM/FCM project or custom opt-in with useinsider.com domain, then we can provide the tokens but the tokens may not be usable since they are matched with Insider GCM/FCM project or domain.
      If you want to use your own GCM/FCM project later on, the old tokens will be removed. Therefore, it would be a good practice to start the opt-in screens with your own GCM/FCM project during the integration.

      We have existing subscribers/tokens from another push provider. Can we use/import them?

      If you use native opt-in with another vendor, we can automatically generate new tokens for the old subscribers without displaying the opt-in screen, once they revisit the website. The old subscribers can be re-subscribed in one month or more depending on the daily traffic. If you use a custom opt-in with another vendor's domain, the auto-subscription will not work and the users would need to allow the opt-in again. We do not perform a manual database import.

      Does the Service Worker affect the performance of my website?

      A Service Worker is a special JavaScript file which runs a separate thread from the main browser thread and registers against an origin and a path. Once it's registered on user's browser, it stays there regardless of being online. So, once the user visits the website, the browser checks if there is an update on the Service Worker so that the user's version is always up-to-date. It does not have a negative affect on website performance because it does not run on the website or it is not loaded like other JavaScripts.

      Can I host Service Worker on a CDN?

      You cannot host Service Worker on a Content Distribution Network, it must be on the same domain as the page and accessible directly from www.mywebsite/insider-sw-sdk.js or from a subfolder under the same domain like www.mywebsite.com/insider/insider-sw-sdk.jsThe document registering the Service Worker, scope of the Service Worker and the main script of the Service Worker, they all have to be from the same origin.

      Can Service Worker run on HTTP sites?

      No, it cannot. For security reasons, Service Workers run only over HTTPS. Remote origin Service Workers are not allowed, otherwise it would give a remote origin control.

      Can I use two web push providers at the same time?

      If you use native opt-in, then yes, you can. You need to put Insider's Service Worker in a subpath like www.mywebsite.com/subpath/insider-sw-sdk.js.

      I want to migrate my website to a new website which has a new domain. Would it be possible to transfer the web push tokens from my old website to the new one?

      If it is different domain, then it's not possible because tokens are associated with domains.

      Do I lose tokens after switching from HTTP Opt-in to Native Opt-in?

      Since users subscribe to notifications on the "https://mywebsite.api.useinsider.com" domain with HTTP Opt-in, these subscriptions are not valid for your domain such as "https://www.mywebsite.com ". However, previously opted users receive pushes until their opt-in cookie expires. They need to opt-in again later on.


      Was this article helpful?


      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses