How to integrate Web Push with Salesforce Commerce Cloud?

Here is a step-by-step guide on how to integrate Batch into your website managed with SalesForce Commerce Cloud.

Basic web push integration relies on two parts: adding a JavaScript tag to the pages of your website and uploading Batch's Service Worker to the root of your website.

If you are using Salesforce Commerce Cloud (SFCC) as a CRM for your website, you won't have access to the root of your website to upload Batch's Service Worker.

Here are the necessary steps to complete the web push integration with SFCC:

1. Add the Service Worker

1

Create an SFCC object

First, you need to create an SFCC object with the type « Content Asset » (for example, "ServiceWorker-GetFile").

Then add the JavaScript content of the service worker (batchsdk-worker-loader.js) to the body of this object.

➡️ Download the Service Worker

2

Create an alias of the route to the Service Worker

Create an entry in "Business Manager" → "Merchant Tools" → "SEO" → "Aliases".

Salesforce merchant tools list indicating where to find Aliases section

This entry must route "/batchsdk-worker-loader.js" to the Content Asset created in Step 1 (e.g. "ServiceWorker-GetFile"):

{   ...
    "your-host" : \[
    ...,     
    {       
    "if-site-path": "/batchsdk-worker-loader.js",
    "pipeline": "ServiceWorker-GetFile"     
    }   
  \]
}

The service worker should now be available here: https://mywebsite.com/batchsdk-worker-loader.js.

2. Add the JavaScript tag and test your integration

Once the Service Worker is added, you can complete the integration by following this guide: How to implement Web Push with Batch?

Last updated

Was this helpful?