Campaign Cart SDK
The Campaign Cart SDK turns a plain HTML landing page into a working cart and checkout. You add data-next-* attributes to the markup you already have, and the SDK finds them, fetches the campaign's packages and prices, keeps a cart, and takes the visitor through checkout to an order, without you writing any JavaScript.
The shortest page that works:
<head>
<script type="module" src=".../loader.js" data-campaign="{YOUR_CAMPAIGN_API_KEY}"></script>
</head>
<body>
<button data-next-action="addItem" data-next-package-id="42">
Add to cart <span data-next-query="package.42.price"></span>
</button>
<span data-next-query="cart.quantity"></span> items, total <span data-next-query="cart.total"></span>
</body>That page adds package 42 to a cart, shows its price in the campaign's currency, and keeps the two totals in sync as the visitor clicks. Everything else on this site is a variation on those three steps: mark an element, name a value, react to a change.
Where to go next
Quickstart: a whole landing page to copy, line by line. Recipes: one common task per page: bundle tiers, order bumps, variants, coupons, upsells, the receipt.
What 0.5 improves: about 5× less JavaScript on a landing page, prices sooner, events shaped like webhooks.
Migrating from 0.4.x: pages built for 0.4.x keep working. This lists what changes for a page builder.
Building Pages: one page per step of a funnel: Landing and Presell, Checkout, Upsell and Receipt.
Reference: Attributes for everything the SDK reads from a page, JavaScript API for window.next, and Events for what next.on and next.analytics.on receive.
Event Reference: every event next.on receives, with its fields and an example. window.next and the event envelope are generated from the source.
Reading this site
- Start Here is for a page moving from 0.4.x.
- Attributes, Events and JavaScript API, picked with the switcher above the sidebar, are for looking things up mid-build: an attribute you found in markup, a method, an event.
- The Event Reference is generated from the SDK's types, so its fields always match the shipped code.
- The version selector at the top of the page switches between released SDK versions. A page pinned to an older version documents that version, not this one.