SalesForce Commerce Cloud
Salesforce Commerce Cloud has a similar setup as Hubspot. The first job is to create the Service Worker file as a SFCC object with the type « Content Asset » (for example "ServiceWorker-GetFile"). Then add the JavaScript content of the service worker (sw.js) to the body of this object.
importScripts('https://static.edgeme.sh/edgemesh-sw.js')
Next, we will create a proxy (called an Alias in SFCC context) to our Service Worker. Create an entry in "Business Manager" → "Merchant Tools" → "SEO" → "Aliases".
This entry must route "/sw.js" to the Content Asset created in the step above (e.g. "ServiceWorker-GetFile"):
{ ... "your-host" : [ ..., { "if-site-path": "/sw.js", "pipeline": "ServiceWorker-GetFile" } ] }
Confirm that the worker file is now available at the root, for example: https://mystore.com/sw.js. Once the Service Worker is added, you can complete the integration by adding the Edgemesh Client code to the head of the website (similar to any other JavaScript tag).
<script async type="text/javascript" src="https://static.edgeme.sh/client.js" onload="window.edgemesh = new Edgemesh()">
Copy link