Source: https://usedataowl.com/docs/forms-setup
Markdown source: https://usedataowl.com/docs/forms-setup.md
Description: Show pop-up micro-surveys on specific pages, after a delay, on scroll, on click, on exit intent or from your own code, using your existing DataOwl script.

# How to Set Up Feedback Forms & Micro-Surveys in DataOwl

Forms are short surveys shown to your visitors: up to 20 questions, in a corner popup or full screen. They load with the script you already have, on Pro and Team.

## Create a form

1. Open **Forms** in your site's dashboard and create a form.
2. Add up to 20 questions:

| Question | What visitors see |
| --- | --- |
| Stars | 1 to 5 stars, with an optional label at each end |
| Choice | 2 to 6 buttons; the visitor picks one |
| Text | A short or long free-form answer, up to 2,000 characters |

   Each question can be required or optional. After the last one, visitors see your thank-you message.
3. Pick how it looks: **Bottom right**, **Bottom left** or **Full screen**, a light, dark or automatic theme, and your accent color.

## Pick when it shows

| Trigger | When the form appears |
| --- | --- |
| On page load | After the page has been open a few seconds (3 by default) |
| On scroll | Once the visitor scrolls part of the way down (50% by default) |
| On click | When the visitor clicks an element matching a CSS selector you enter |
| On exit intent | When the pointer heads for the tab bar. Desktop only. |
| From your code | Only when your site calls `showForm`. See [below](#open-a-form-from-your-code). |

- **Pages:** list path patterns like `/pricing` or `/blog/*`, where `*` matches anything. Leave it empty to show the form everywhere.
- **How often:** once per visitor (answered or closed), or every visit until they answer.

## Go live

Set the form to **Live**. Draft and paused forms aren't shown.

The script loads `/js/forms.js` (about 9 KB gzipped) only when the site has a live form, so other sites load nothing extra. Add `data-forms="false"` to the tag to turn forms off. Behind a [proxy](/docs/proxy-guide), forward `/js/forms.js` and `/api/forms` too.

## Open a form from your code

Set the trigger to **From your code** and the form never opens by itself: it waits for your site to ask, after a purchase, from a "Give feedback" button, or on any event of yours. Pass the form's ID, which the editor shows under the trigger:

```js
datasense("showForm", "FORM_ID")

// Even if they already answered or closed it
datasense("showForm", "FORM_ID", { force: true })
```

- It opens any live form, whatever its trigger, and ignores the **Pages** list: where you call it decides.
- Visitors who already answered or closed the form (see **How often**) are skipped. `force: true` opens it anyway, which suits a button the visitor pressed.
- One form shows at a time. A call while another form is open does nothing.
- To call it before the script has loaded, put the queue stub above the script tag. Calls wait until the forms have loaded:

```html
<script>
  window.datasense = window.datasense || function () {
    (window.datasense.q = window.datasense.q || []).push(arguments)
  }
</script>
```

- The script ignores `localhost`. Add `data-allow-localhost="true"` to try it there.

### With the npm SDK

```ts
import { PostHog } from "@datasense/browser"

const datasense = new PostHog("YOUR_SITE_ID", {
  host: "https://usedataowl.com/api/sdk",
  forms: true,
})

datasense.showForm("FORM_ID")

// Even if they already answered or closed it
datasense.showForm("FORM_ID", { force: true })
```

`forms: true` also opens the site's other live forms on their own triggers. Without it, `showForm` loads the forms the first time you call it. It resolves to `true` when the form opened.

## Read the results

Each form's page shows how often it was **shown**, how many visitors **responded** and **completed** it, and the **response rate**. Star and choice questions get a breakdown. Every response lists the visitor's country, city, browser and device, with links to their profile and, when the session was recorded, their [replay](/docs/session-replay).

## Limits

- Up to 20 questions, with no branching logic and no 0 to 10 NPS scale.
- No inline form inside your page.
