Benson install guide for developers
Everything a developer needs to add Benson to a store: the snippet, where it goes, CSP, consent, SPA navigation and the cart API.
Someone asked you to add Benson to their store. Here's the short version, with links to the detail.
The snippet#
The store owner's snippet (with their site key) is in the email that sent you here, or in Benson under Site settings → Install:
<script async src="https://cdn.trybenson.com/benson.js" data-site="pk_live_YOUR_SITE_KEY"></script>Put it in <head> on every page. It's async, about 2.5KB compressed, loads its modules when the browser is idle, and never throws into the page.
Allow it in your CSP#
If the site sends a Content-Security-Policy, add:
script-src https://cdn.trybenson.com;
connect-src https://api.trybenson.com;
More in Content Security Policy.
Consent#
Benson reads the consent signal your site already has (Shopify, IAB TCF, Google Consent Mode) or waits for you to call Benson.consent(). Details and every storage key it can write are in Consent and storage.
SPAs, headless and custom carts#
- Call
Benson.page()after client-side navigation. - Call
Benson.setCart({ currency, totalMinor, items, codes })whenever the cart changes, so stretch goals and targeting know the basket. - On custom checkouts, register how codes are applied with
Benson.registerApplyHandler().
The full reference is in the JavaScript API.
Verify#
Load any page with ?benson_debug=1 to see what Benson is doing in the console. The site's setup wizard turns green on the first page view.
Stuck? Email [email protected].

