# Kibble installation contract: section 21 of 29 (guide version 3)

> This is **one section only**, not the whole contract. Complete document: https://www.usekibble.dev/AI/guide.md

## 21. BigCommerce {#bigcommerce}

> **Status: fixture-tested adapter.** Run against fake platform objects only. Not verified on a live platform.

- Add a Script Manager script (location Footer, pages Storefront, category Analytics) containing the snippet, the stored-consent re-apply, and the BODL subscriptions.
- Mapped events: `product.pageViewed`, `cart.addItem`, `checkout.checkoutBegin`, `checkout.orderPurchased`. No customer fields are read.
- **Confirmation:** a purchase is confirmed only from `orderPurchased` with an `order_id` (hashed in the browser; repeated callbacks yield one outcome).
- **Provenance:** pass `source: 'adapter'` on the outcome, as the packaged adapter does. The source feeds the per-signal meaning rules staff configure in Data tracking → Events.
- **Consent:** BigCommerce does not decide for you. Re-apply your banner's stored choice before the SDK loads; nothing is collected until `granted`.
- **Boundary:** the BODL object is only available on pages BigCommerce renders it for. Hosted checkout pages may not run Script Manager scripts on every plan. Verify on your store; Kibble has run this only against a fixture object.

Script Manager (condensed; full version: integrations/examples/bigcommerce/kibble-script-manager.html):

```html
<script>window.kibble=window.kibble||function(){(window.kibble.q=window.kibble.q||[]).push(arguments)};
try{var c=localStorage.getItem('YOUR_CONSENT_KEY');if(c==='granted'||c==='denied')kibble('consent',c)}catch(e){}</script>
<script async src="https://use.example-kibble-host/sdk/v1/kibble.js" data-key="pk_YOUR_PROPERTY_KEY" data-endpoint="https://use.example-kibble-host" data-consent="manual"></script>
<script>
(function () {
  var b = window.bodlEvents; if (!b) return;
  var k = function () { return window.kibble.apply(null, arguments); };
  b.product.pageViewed(function (e) {
    var li = (e.line_items && e.line_items[0]) || {};
    k('track', 'product_view', { product: String(li.product_id || '') }, { price: li.sale_price != null ? li.sale_price : li.base_price });
  });
  // ... cart.addItem -> add_to_cart, checkout.checkoutBegin -> checkout_step: identifiers and amounts only
  b.checkout.orderPurchased(function (e) {
    if (!e.order_id) return;                          // no order id: not a confirmed purchase
    k('outcome', { type: 'purchase', ref: String(e.order_id), value: e.order_value, currency: e.currency, source: 'adapter' });
  });
})();
</script>
```

END OF SECTION bigcommerce
