Set Up Push Campaigns

Installing the Service Worker

For your Push Campaigns to reach your subscribers, you will need to install a snippet of code under your domain. Specifically, you are installing the Re:amaze service worker, which will be loaded on your customer's browser when they subscribe for push notifications. When you send a Push Campaign, Re:amaze will communicate with this service worker to display a push notification on that subscriber's device. Neat huh?

The following snippet must be installed on your site under the path /rmzServiceWorker.js and be publicly accessible:

importScripts('https://push.reamaze.com/sdks/rmzServiceWorker.js');

So, if your domain is https://example.com, the above snippet would be loaded under https://example.com/rmzServiceWorker.js.

Next Step: Re:amaze Embeddables

Your website must also have a Re:amaze embeddable or Base Installation Script installed. For more instructions on how to build an embeddable for your store, you can look at our article here. Once this is done, Re:amaze will be able to collect your customer's push tokens and add them as subscribers to your Push Campaigns!

Dec 15, 2020