Skip to Content
Klarefi
Guides

Embed

Connect your whole site once, or put one Klarefi intake on it as a button, an inline form, a floating launcher, a link or a plain frame

The embed script renders your published intake link inside your own site. Applicants fill out the form, upload documents, and answer follow-up questions without leaving your page. Your branding and form logic carry over because the embed renders the same hosted intake.

Connect your whole site

This is the simplest way. Add the script once, anywhere on your site, for example in the footer or the page head:

<script
  async
  src="https://app.klarefi.com/embed/v1.js"
  data-mode="links"
></script>

Use the same address for the script as your form links use. If your forms are on your own intake domain, such as apply.example.com, load the script from that domain too; the script only takes over links on the address it was loaded from.

Then put any form's link on any button or link in your site, the way you link to any other page. When a visitor clicks it, the form opens on top of your page instead of taking them away. The link's text and style stay yours; the script adds nothing to your page until someone clicks.

  • It takes over ordinary HTML links (<a href>) whose address is a form link on that same address: https://<that address>/i/<link>. It works for every form you publish, and for links your site adds later, so you never paste a snippet per form.
  • These stay normal links: a click with Cmd, Ctrl, Shift or Alt held, a middle click, a link that opens in another tab or window (its own target or your page's <base target>), a download link, a link with rel="noreferrer" or its own referrerpolicy, and links to anything else.
  • If your site's router or another script cancels the click first, it wins and the form does not open on top.
  • The form opens in a dialog with a link to open the application page instead, so a visitor can still get to the form if your site blocks the frame. Escape, the close button and clicking outside close it, and focus returns to the link. In a browser without modal dialogs, the link simply opens the form's own page.
  • Opening another form's link replaces the first form in the dialog, so an application started there is not kept open in it.
  • A form whose Allowed websites list leaves your site out does not load in the dialog. Visitors get its link to open instead. See Security notes.
  • The dialog's few words follow your page's language, English or Dutch. Set data-locale="nl" or data-locale="en" on the script tag to choose.
  • Without the script, or before it has loaded, the same link opens the form's own page. A button can never end up doing nothing.

Each form's link is in the dashboard: open a workflow and choose Share application link.

One form at a time

Pick a snippet for one form below and replace your-link-slug with the part after /i/ in the form's link. Find the link in the dashboard: open a workflow and choose Share application link. Use the script address of your Klarefi domain if you have one.

ModeWhat visitors seeNeeds the script
ButtonA button where you paste it; the intake opens on topYes
InlineThe intake inside your pageYes
LauncherA floating button in the corner that opens a panelYes
LinkA link styled as a button; the intake opens in a new tabNo
FrameThe intake in a frame with a fixed heightNo

Use Link or Frame when your website builder does not allow scripts on your plan. Your intake link itself also works as the target of any button your builder gives you.

Button

Renders a button where you paste the snippet. Pressing it opens the intake on top of your page. Escape, the close button and clicking outside close it, and the intake keeps its state when it is opened again.

<script
  async
  src="https://app.klarefi.com/embed/v1.js"
  data-klarefi-intake="your-link-slug"
  data-mode="button"
  data-label="Start your application"
></script>

data-label sets the text on the button. data-color="#0f172a" sets its background colour. data-target="#some-element" puts the button inside an element of your choice instead of where the script sits.

Inline

Renders the intake into an element on your page and auto-resizes to the content height.

<div id="klarefi-intake"></div>
<script
  async
  src="https://app.klarefi.com/embed/v1.js"
  data-klarefi-intake="your-link-slug"
  data-mode="inline"
  data-target="#klarefi-intake"
></script>

If data-target is omitted or does not match an element, the script creates a container right before its own script tag.

Launcher

Adds a floating button in the bottom-right corner that opens the intake in a panel. Escape and clicking outside close the panel. The panel keeps its state across open and close, so applicants never lose progress.

<script
  async
  src="https://app.klarefi.com/embed/v1.js"
  data-klarefi-intake="your-link-slug"
  data-mode="launcher"
></script>

Optional: data-color="#0f172a" recolors the launcher button to match your site.

A link styled as a button. It opens your hosted intake in a new tab and needs no script, so it works on every website builder and plan.

<a
  href="https://app.klarefi.com/i/your-link-slug"
  target="_blank"
  rel="noopener"
  style="display:inline-block;padding:12px 20px;border-radius:8px;background:#2563eb;color:#fff;font:600 16px/1.2 system-ui,sans-serif;text-decoration:none"
  >Start your application</a
>

If your builder has its own button element, set that button's link to your intake link instead.

Frame

Shows the intake in a plain frame, for builders that accept a frame but no script. The height is fixed because nothing on your page can resize it, so pick a height that fits your longest step.

<iframe
  src="https://app.klarefi.com/i/your-link-slug?embed=1"
  title="Start your application"
  allow="clipboard-write"
  style="width:100%;height:900px;border:0"
></iframe>

JavaScript API

The script exposes window.Klarefi:

MethodDescription
Klarefi.open()Opens the button's or the launcher's intake, not a link
Klarefi.close()Closes it
Klarefi.on(ev, cb)Subscribes to an event, returns an unsubscribe function

Events

The iframe posts namespaced messages to your page. The script accepts messages only from the origin it was loaded from and only from its own frames. Payloads never contain applicant data.

EventPayloadWhen
klarefi:readynoneThe intake finished booting inside the iframe
klarefi:resize{ height }Content height changed; inline mode resizes
klarefi:submitted{ sessionId }The applicant submitted the intake

Subscribe with the plain event name:

Klarefi.on("submitted", function (payload) {
  console.log("Intake submitted", payload.sessionId);
});

Single-page apps

The script is idempotent. If your router injects it again on navigation, an intake that is already mounted stays untouched and no duplicate is created. With data-mode="links", links your router renders later open on top of the page without running anything again.

Attribution

Embedded intakes show a small "Powered by Klarefi" link below the form.

Not the sessions snippet field

The snippet field returned by POST /api/v1/sessions is a redirect helper: it sends the browser to the hosted session page. It does not embed anything. Use the embed script on this page to render an intake inside your site, and signed_url when you want to redirect an applicant to a session you created through the Sessions API.

Browser support

The embedded session uses a partitioned cookie (CHIPS) so it works with third-party cookie blocking in current Chrome, Edge, Firefox, and Safari 18.4 or later. On browsers that reject all third-party cookies, applicants can still use your hosted intake link directly.

Security notes

  • To limit where an intake can appear, open Share application link for that workflow. Open Allowed websites, enter up to ten website addresses, one per line, and save. Use the start of your site's address, such as https://www.example.com, without a page name. Add each subdomain separately. For local testing, you can use http://localhost with your local port.
  • Leave the list blank to allow any website. If a website can't load the form through the Klarefi snippet, visitors get an Open the form link. The plain link always opens the intake directly, even on sites outside the list.
  • The list applies to the workflow's intake and its applicant session pages, including sessions started through the API and forms on your custom intake domain. Changes apply when the browser next loads an embedded page.
  • If your site enforces a Content Security Policy, allow the Klarefi origin in script-src and frame-src. If your policy uses nonces or 'strict-dynamic', an origin entry is not enough: give the script tag your page's nonce (<script nonce="…" async src="…">) or load it through the script loader your site already trusts.
  • The script assigns no HTML markup, so it runs under a Trusted Types policy (require-trusted-types-for 'script') without a policy of its own.
  • The dialog's dimmed backdrop comes from a small style element the script adds. If your policy limits style-src, allow it with the same nonce you give the script tag (the script copies it), or the backdrop falls back to the browser's default.

On this page