CommerceOS

Widget & API

Visitor notifications

Let visitors get a notification when your team replies.

If a visitor leaves before your team replies, they can opt in to a browser notification. This needs one small file on your own website, because browsers only allow notification workers from the site itself.

  1. Host the worker file

    Create a file at the root of your site called cos-sw.js containing this single line: importScripts("https://cdn.selfserve.cosmos.hub.nortq.com/v1/sw.js");

  2. Point the widget at it

    Add data-service-worker="/cos-sw.js" to your install code, or pass serviceWorker: "/cos-sw.js" to createChat.

Visitors are then offered "notify me when someone replies" in the chat. Nobody is asked unless the worker is set up.