Install Benson on Magento
Add the Benson snippet under HTML Head in Magento's design configuration, allow it in the checkout CSP, and check it's live.
Jump to a section
These are the same steps the setup wizard shows for Magento.
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 Magento#
- In the Magento admin, go to Content → Design → Configuration and edit your store view.
- Open HTML Head → Scripts and Style Sheets.
- Paste the snippet, save the configuration, and flush the page cache.
Allow Benson in Magento's content security policy#
Magento 2.4.7 and later enforce a strict content security policy on checkout, so the browser refuses Benson's script there unless your store allows it. Add Benson's hosts to a csp_whitelist.xml in one of your own modules (for example app/code/YourCompany/Benson/etc/csp_whitelist.xml), then run bin/magento cache:flush:
<?xml version="1.0"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="benson-script-1" type="host">cdn.trybenson.com</value>
<value id="benson-script-2" type="host">api.trybenson.com</value>
</values>
</policy>
<policy id="connect-src">
<values>
<value id="benson-api-connect" type="host">api.trybenson.com</value>
</values>
</policy>
</policies>
</csp_whitelist>Without it, Benson runs on your storefront and cart but not on checkout.
Check it's live#
Open your store in a normal browser tab. The setup wizard shows Verified: Benson is live within a few seconds. If it doesn't, see Troubleshooting.
Checkout rules#
On Magento, Benson's script runs on your checkout, so it can hide extension pop-ups there and guard the coupon form. For a server-side check, call the policy check API from your coupon validation; code samples are in Checkout rules → Install in your dashboard. A full Magento module isn't available yet.
Stuck? Email [email protected].
