Install Benson on Salesforce Commerce Cloud
Add the Benson snippet to your SFRA storefront's htmlHead template in a custom cartridge, deploy the code, and check it's live.
Jump to a section
On Salesforce B2C Commerce (Commerce Cloud), add Benson to your storefront's head template in a custom cartridge on top of the SFRA base cartridge. This is a developer task involving one template and a code deploy. Choose Other as your platform in the setup wizard.
Your snippet#
Your real snippet, with your site key, is in the setup wizard and under Settings → Install:
<script async src="https://cdn.trybenson.com/benson.js" data-site="pk_live_YOUR_SITE_KEY"></script>Add it to your storefront#
- In your custom cartridge, override
cartridge/templates/default/common/htmlHead.ismlfromapp_storefront_base: copy the base template to the same path, and paste your snippet at the end of it. - In Business Manager, make sure your cartridge sits to the left of
app_storefront_baseon the site's cartridge path. - Upload the code version, then activate it under Administration → Site Development → Code Deployment.
- Clear the page cache under Administration → Sites → Manage Sites → your site → Cache.
If your storefront isn't on SFRA, add the snippet to the template that renders the <head> of every page, including checkout.
Check it's live#
Open your storefront in a normal browser tab. The setup wizard shows Verified: Benson is live within a few seconds. If it doesn't, see Troubleshooting.
Good to know#
- Open your checkout and check that the snippet is in its page source. If checkout has its own layout template, add the snippet there too.
- If your site sends a Content Security Policy, allow Benson's hosts. See CSP.
Stuck? Email [email protected].
