> Add a free, local-only Plandalf countdown timer to any website with plandalf('countdown', options) or HTML attributes, with full style customisations and developer hooks.

Source: https://plandalf.com/docs/promos/free-countdown-sdk

Deadline timers

# Free countdown timer SDK

The free countdown script at `https://plandalf.com/embed/countdown.js` uses the same `plandalf()` command-queue pattern and `style` object shape as Plandalf's main SDK, running 100% in the browser with no account, no server calls and no cookies. Use the [countdown timer builder](https://plandalf.com/tools/countdown-timer) to customise one visually, or pass options directly in code below.

## Quick install with JavaScript

Load the script asynchronously and call `plandalf('countdown', options)`:

```html
<div id="timer"></div>
<script async src="https://plandalf.com/embed/countdown.js"></script>
<script>
  window.plandalf = window.plandalf || function () { (window.plandalf.q = window.plandalf.q || []).push(arguments); };
  plandalf('countdown', {
    target: '#timer',
    until: '2026-12-31T23:59:59Z',
    style: {
      bg: '#111111',
      digitColor: '#ffffff',
      labelColor: '#888888',
      separatorColor: '#444444',
      digitBoxBg: '#1e1e1e',
      digitBoxBorder: '#333333',
      separator: 'colon',
      showLabels: true,
      label: 'Offer ends in',
      expiredText: 'OFFER EXPIRED',
    },
  });
</script>
```

## Quick install with HTML attributes

Any element with `data-pf-countdown` mounts automatically when the script loads:

```html
<div
  data-pf-countdown
  data-duration="172800"
  data-storage-key="launch-offer"
  data-placement="bar-top"
  data-cta-label="Claim 20% off"
  data-cta-url="https://yoursite.com/offer"
  data-style='{"bg":"#0f172a","digitColor":"#e2e8f0","labelColor":"#94a3b8","label":"Early-bird pricing ends in"}'
></div>
<script async src="https://plandalf.com/embed/countdown.js"></script>
```

## Options

Option

Default

What it does

`target`

`null`

CSS selector or DOM element for `inline` placement (ignored for sticky bars).

`until`

24h ahead

ISO 8601 timestamp for a fixed deadline, displayed in the visitor's local clock.

`durationSeconds`

`0`

When set (> 0), runs a local evergreen countdown saved in `localStorage` under `plandalf_free_timer_<storageKey>`.

`storageKey`

`'default'`

Key suffix for local evergreen storage so refreshes keep the same deadline.

`placement`

`'inline'`

`'inline'`, `'bar-top'` or `'bar-bottom'`.

`onExpire`

`'message'`

`'message'` (shows `style.expiredText`), `'hide'` or `'redirect'` (uses `redirectUrl`).

`ctaLabel` / `ctaUrl`

empty

Optional call-to-action button rendered inside the timer or sticky bar.

`style`

dark boxed

Visual customisation object: `bg`, `digitColor`, `labelColor`, `separatorColor`, `expiredColor`, `digitBoxBg`, `digitBoxBorder`, `digitBoxRadius`, `separator` (`'colon'`, `'line'`, `'dot'`, `'none'`), `showLabels`, `label`, `expiredText`, `borderRadius`, `border`, `ctaBg`, `ctaColor`.

## Plug in your own tracking

If you want to drive deadlines from your own backend, cookie or CRM, pass `resolveDeadline` and react to `onTick`, `onExpired`, or the bubbling `plandalf:expired` DOM event:

```js
const timer = plandalf('countdown', {
  target: '#timer',
  resolveDeadline: () => fetchDeadlineFromYourCookieOrApi(),
  style: { bg: '#0b1b3e', digitColor: '#8ceee8', label: 'Your offer ends in' },
  onTick: ({ remainingSeconds }) => {
    if (remainingSeconds === 300) showLastChanceNotice();
  },
  onExpired: ({ deadlineMs }) => {
    window.analytics?.track('timer_expired', { deadlineMs });
  },
});

// Read live state or tear down the timer
timer.getRemaining(); // seconds left
timer.getDeadline();  // unix timestamp in ms
timer.close();
```

## Isolation and paid Deadline timers

The free script renders inside Shadow DOM so host site CSS cannot break it, stores local evergreen timestamps under `plandalf_free_timer_*`, and registers the `'countdown'` command cleanly without overwriting the paid SDK if both are present.

When you need server-enforced per-buyer deadlines across devices, animated countdown GIFs inside emails, or automatic checkout price switches, see [Deadline timers](https://plandalf.com/docs/promos/overview).

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