> Every data-plandalf attribute the SDK reads on your page, the attributes on its script tag, and the two custom elements.

Source: https://plandalf.com/docs/developers/attributes

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

```html
<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', …)`](https://plandalf.com/docs/developers/sdk#configure). With `data-plandalf-frame="embedded"`, a button renders its checkout inline when the page loads, with no click.

Attribute

Values

What it does

`data-plandalf-frame`

`modal` `slideout` `bottom` `fullscreen` `embedded`

How 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-initialized`

Set 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-mode`

`test` `live` `preview`

Environment 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-mount`

Offer slug. The SDK renders that offer inline inside the element when the page loads.

`data-plandalf-present`

Offer slug. Clicking the element opens that offer (see `data-plandalf-frame`).

`data-plandalf-size`

`compact` `standard` `wide` `fullscreen`

Modal size preset for a `data-plandalf-present` element. Default `standard`.

`data-plandalf-template`

Deprecated. 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-banner`

Set by the SDK on the "test mode" strip it draws above a checkout that uses test payments.

## Deadline timers

```html
<div data-plandalf-promo="YOUR-PROMO" data-plandalf-hide-on-expire></div>
```

Attribute

Values

What it does

`data-plandalf-apply-promo`

Promo 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-expire`

Present on a promo countdown element: the SDK hides the element when the countdown ends (or the promo has no live config).

`data-plandalf-no-redirect`

Present on a promo element: the auto-scan skips it, so no countdown mounts and no redirect monitor starts for it.

`data-plandalf-promo`

Promo 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-style`

JSON 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](https://plandalf.com/docs/developers/promos-from-code).

## Referral badge and links

```html
<div data-plandalf-referral data-plandalf-variant="note"></div>
<a href="https://shop.example.com/buy" data-plandalf-decorate>Buy</a>
```

Attribute

Values

What it does

`data-plandalf-decorate`

Present 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-referral`

Marks 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-template`

On a `data-plandalf-referral` element: badge wording with a `{partner}` token.

`data-plandalf-theme`

`light` `dark` `auto`

On a `data-plandalf-referral` element: the badge colours.

`data-plandalf-variant`

`pill` `note` `bar` `float`

On a `data-plandalf-referral` element: the badge style. Default `pill`.

See [Referrals from code](https://plandalf.com/docs/developers/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.

Attribute

Values

What it does

`data-plandalf-fonts`

Set 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-preconnect`

Set by the SDK on the `<link rel="preconnect">` tags it adds for fonts.googleapis.com and fonts.gstatic.com.

`data-plandalf-fonts-url`

Set by the SDK next to `data-plandalf-fonts`: the Google Fonts CSS URL that `<style>` tag holds.

`data-plandalf-tailwind`

Set 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

```html
<script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js" data-prefetch="false" data-config-ref="email"></script>
```

Attribute

Values

What it does

`data-api-base`

Origin 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-ref`

Comma-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-consent`

`required`

`"required"` waits for `plandalf('consent', true)` before the SDK reads referral params or storage.

`data-config-referral-cookie`

Cookie name the SDK also writes the referral token to (as well as `pf_rt`).

`data-config-referral-decorate`

Comma-separated hostnames whose outbound links get `pf_rt=<token>` appended on click.

`data-config-referral-global`

Name of a `window` global the SDK sets to the referral token, for tools that read an old tracker's global.

`data-config-referral-metadata-key`

Key `referral.metadata()` uses. Defaults to the program's setting (`plandalf_referral`).

`data-config-referral-params`

Comma-separated link params that carry a partner code. Defaults to the program's setting (`via`).

`data-debug`

`true`

`"true"` logs what the SDK does to the console. Only used when the SDK starts itself.

`data-prefetch`

`false`

`"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](https://plandalf.com/docs/developers/sdk#how-it-starts).

## 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.

```html
<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.

Attribute

Values

What it does

`color`

Any CSS color; sets the accent (`--pl-color`). Default `#0a0a0a`.

`disabled`

Disables the button.

`frame`

`modal` `slideout` `bottom` `fullscreen`

How the offer opens. Default `modal`.

`frame-size`

`compact` `standard` `wide` `fullscreen`

Modal size preset, passed to present() as `size`.

`label`

Button text. Without it the element's own content is used, falling back to "Buy now".

`loading`

Disables the button and shows a spinner. The SDK sets it while the offer is open and removes it when the offer closes.

`mode`

`test` `live` `preview`

Environment, passed to present() as `mode`.

`offer`

Required. Offer slug to open on click.

`size`

`sm` `md` `lg`

Button size. Default `md`.

`variant`

`solid` `outline` `pill` `brand`

Button 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.

Attribute

Values

What it does

`template`

Badge wording with a `{partner}` token. Defaults to the program's badge text.

`theme`

`light` `dark` `auto`

Colours; `auto` follows the visitor's system setting. Default `light`.

`variant`

`pill` `note` `bar` `float`

Badge style. Default `pill`.

Something wrong or missing? Email [hello@plandalf.com](mailto:hello@plandalf.com).
