PlandalfDocsSign inStart free trial

Developers

Script and HTML attributes

These are the attributes the SDK reads, so you can add checkouts, countdowns and the referral badge without writing JavaScript. The SDK finds them when it starts and when your page adds elements later.

Checkouts

<button data-plandalf-present="YOUR-CHECKOUT" data-plandalf-frame="slideout" data-plandalf-size="wide">Buy now</button>
<div data-plandalf-mount="YOUR-CHECKOUT" style="min-height: 480px"></div>

A button takes data-plandalf-present, -frame, -size, -mode and -apply-promo. A mount takes data-plandalf-mount, -mode and -apply-promo. Other options, such as properties, metadata and continuity, only exist in code; set them page-wide with plandalf('configure', …). With data-plandalf-frame="embedded", a button renders its checkout inline when the page loads, with no click.

AttributeValuesWhat it does
data-plandalf-framemodal slideout bottom fullscreen embeddedHow a data-plandalf-present element opens its offer: in a modal, a side slideout, a bottom sheet or full screen on click, or embedded to render it inline in the element on page load. Default modal.
data-plandalf-initializedSet to "true" by the SDK once it has bound a present/mount element, so later scans skip it. Canonical attributes: <button data-plandalf-present="<offer>">Buy</button> → click trigger <div data-plandalf-mount="<offer>"></div> → inline mount <div data-plandalf-promo="<promo>"></div> → live countdown / promo widget data-plandalf-apply-promo="<promo>" → on a present/mount, apply tier pricing Deprecated (still scanned for one release, with a console warning): data-plandalf-mount="checkout"+template → use data-plandalf-mount="<offer>"
data-plandalf-modetest live previewEnvironment for the checkout a present/mount element opens, passed as mode. With test, the checkout runs in test mode on the organization's test domains, for people signed in to the organization, with an identify() token carrying "mode": "test", or from a signed test link; anywhere else it runs live. Test mode also needs the organization's Stripe test account. preview is for the dashboard editor; on a page it runs live.
data-plandalf-mountOffer slug. The SDK renders that offer inline inside the element when the page loads.
data-plandalf-presentOffer slug. Clicking the element opens that offer (see data-plandalf-frame).
data-plandalf-sizecompact standard wide fullscreenModal size preset for a data-plandalf-present element. Default standard.
data-plandalf-templateDeprecated. Offer slug read when data-plandalf-mount is the old kind token checkout, portal or widget; put the offer slug in data-plandalf-mount instead.
data-plandalf-test-bannerSet by the SDK on the "test mode" strip it draws above a checkout that uses test payments.

Deadline timers

<div data-plandalf-promo="YOUR-PROMO" data-plandalf-hide-on-expire></div>
AttributeValuesWhat it does
data-plandalf-apply-promoPromo slug. On a data-plandalf-present or data-plandalf-mount element, the checkout it opens uses the promo's active tier price. The SDK also starts the promo's redirect monitor.
data-plandalf-hide-on-expirePresent on a promo countdown element: the SDK hides the element when the countdown ends (or the promo has no live config).
data-plandalf-no-redirectPresent on a promo element: the auto-scan skips it, so no countdown mounts and no redirect monitor starts for it.
data-plandalf-promoPromo slug. On a plain element the SDK renders the promo's live countdown inside it and watches the active tier. On a data-plandalf-present / data-plandalf-mount element it is the deprecated spelling of data-plandalf-apply-promo.
data-plandalf-styleJSON object of style overrides, e.g. {"bg":"#000"}. On a promo widget it adjusts the saved promo style for that one widget; on a referral badge host it sets the badge's CSS variables (--pf-<key>). Malformed JSON is ignored.

See Deadline timers from code.

Referral badge and links

<div data-plandalf-referral data-plandalf-variant="note"></div>
<a href="https://shop.example.com/buy" data-plandalf-decorate>Buy</a>
AttributeValuesWhat it does
data-plandalf-decoratePresent on a link: when the visitor has a referral, the SDK appends pf_rt=<token> to the link's URL on click, whatever its host. Links to hosts in referral.decorate are decorated without it.
data-plandalf-referralMarks an element as the place for the referral badge. The SDK appends a <plandalf-referral> badge inside it when the visitor arrived through a partner link.
data-plandalf-referral-templateOn a data-plandalf-referral element: badge wording with a {partner} token.
data-plandalf-themelight dark autoOn a data-plandalf-referral element: the badge colours.
data-plandalf-variantpill note bar floatOn a data-plandalf-referral element: the badge style. Default pill.

See Referrals from code.

Set by the SDK

The SDK adds these to tags it puts in your page's head. You don't add them yourself, but leave them in place if a plugin strips duplicate styles or fonts.

AttributeValuesWhat it does
data-plandalf-fontsSet by the SDK on the <style> tags holding a checkout's Google Fonts, so each font loads once. Leave these tags in place if a font manager strips duplicates.
data-plandalf-fonts-preconnectSet by the SDK on the <link rel="preconnect"> tags it adds for fonts.googleapis.com and fonts.gstatic.com.
data-plandalf-fonts-urlSet by the SDK next to data-plandalf-fonts: the Google Fonts CSS URL that <style> tag holds.
data-plandalf-tailwindSet by the SDK on the <style> tag holding the checkout's CSS when it is added to the page head instead of the checkout frame.

On the script tag

<script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js" data-prefetch="false" data-config-ref="email"></script>
AttributeValuesWhat it does
data-api-baseOrigin the SDK calls for offers and checkouts. Defaults to the origin the script was loaded from. Only used when the SDK starts itself; a queued plandalf('init', …) passes its own apiBase.
data-config-refComma-separated URL params that carry the visitor's identity (for example email), tried after pf_ref and ref. Same as configure({ ref }). Only used when the SDK starts itself.
data-config-referral-consentrequired"required" waits for plandalf('consent', true) before the SDK reads referral params or storage.
data-config-referral-cookieCookie name the SDK also writes the referral token to (as well as pf_rt).
data-config-referral-decorateComma-separated hostnames whose outbound links get pf_rt=<token> appended on click.
data-config-referral-globalName of a window global the SDK sets to the referral token, for tools that read an old tracker's global.
data-config-referral-metadata-keyKey referral.metadata() uses. Defaults to the program's setting (plandalf_referral).
data-config-referral-paramsComma-separated link params that carry a partner code. Defaults to the program's setting (via).
data-debugtrue"true" logs what the SDK does to the console. Only used when the SDK starts itself.
data-prefetchfalse"false" stops the SDK downloading the checkout runtime while the page is idle. Same as prefetch: false. Default true.

The SDK only reads data-api-base, data-debug and data-config-ref when it starts itself. A queued plandalf('init', …) passes its own config instead; see Starting the SDK.

Custom elements

Two tags work without any attributes on your own elements. <plandalf-buy-btn> is a styled button that opens a checkout, like a data-plandalf-present button; its styles live in Shadow DOM, so your page's CSS and the button's don't affect each other, and you can style it from outside through ::part(button). <plandalf-referral> is the referral badge as its own tag, shown only when the visitor came through a partner link.

<plandalf-buy-btn offer="YOUR-CHECKOUT" variant="pill" color="#4f46e5">Buy now</plandalf-buy-btn>

<plandalf-buy-btn>

<plandalf-buy-btn offer="my-offer">Buy now</plandalf-buy-btn>: a styled button that opens an offer, the same as a data-plandalf-present trigger. Its styles live in Shadow DOM, so the page's CSS and the button's stay apart.

AttributeValuesWhat it does
colorAny CSS color; sets the accent (--pl-color). Default #0a0a0a.
disabledDisables the button.
framemodal slideout bottom fullscreenHow the offer opens. Default modal.
frame-sizecompact standard wide fullscreenModal size preset, passed to present() as size.
labelButton text. Without it the element's own content is used, falling back to "Buy now".
loadingDisables the button and shows a spinner. The SDK sets it while the offer is open and removes it when the offer closes.
modetest live previewEnvironment, passed to present() as mode.
offerRequired. Offer slug to open on click.
sizesm md lgButton size. Default md.
variantsolid outline pill brandButton style. Default solid.

<plandalf-referral>

<plandalf-referral>: a badge naming the partner who sent the visitor, with their avatar and a ring that drains with the Promo their link targets. Shows nothing without a referral, when the program's badge is off, for holdout visitors, or after the visitor dismissed it.

AttributeValuesWhat it does
templateBadge wording with a {partner} token. Defaults to the program's badge text.
themelight dark autoColours; auto follows the visitor's system setting. Default light.
variantpill note bar floatBadge style. Default pill.