Embed a survey on your website
Two lines of HTML put a Votense survey inside your own site. Both methods are demonstrated live on this page, with the exact code under each one.
A Votense survey can live on your own site instead of behind a link. The survey runs inside an iframe, so your CSS cannot break it and it cannot break your page — the approach most embeddable survey tools use.
These demos are live
The script: a survey that resizes itself
This is the snippet to use unless something stops you. The loader injects the iframe and then listens for height messages from it, so the frame grows as fields expand, validation messages appear, and the confirmation replaces the survey. There is never an inner scrollbar and never a height for you to guess at.
The script is dependency-free and under 4 KB. It adds one global, SeagitForms, touches nothing else on your page, and is wrapped so that a failure means the survey does not appear rather than your page breaking. It is cached for ten minutes, so a fix reaches every site that embeds a survey within minutes.
<div data-seagit-form="demo-poll"></div> <script src="https://votense.com/embed.js" async></script>
Where the script goes
async attribute means it never blocks rendering, and the loader waits for the document if it arrives early. Embedding several surveys on one page needs only one copy of the script tag.The iframe: works where scripts do not
Some hosts strip <script> tags — Notion, and the cheaper tiers of several website builders. A plain iframe still works there, and needs nothing from us at all.
The trade is height. Without the script there is no way for the survey to tell your page how tall it has become, so you set a fixed height. Pick one that fits the longest state of your survey, which is usually the survey with every validation message showing. Too small and respondents get a scrollbar inside the frame; too large and you get white space under it.
<iframe src="https://votense.com/embed/demo-poll" width="100%" height="600" style="border:0" title="Form" ></iframe>
Embedding a password-protected survey
A private survey embeds with the same snippet — nothing extra to configure. What respondents meet inside the frame is the password gate, and the survey appears in its place once they enter the password. The demo below is a real private form, so this is the actual gate rather than a picture of one.
The questions are not sent to the browser until the password is accepted. They are not in the page source, and they are not in the embed's server-rendered data — a private survey embedded on a public page gives away nothing but its existence. That is the point of the gate: knowing where the survey is must not be enough to read it.
Not the survey's name either
Which one should I use?
| Script | Iframe | |
|---|---|---|
| Resizes to fit the survey | Yes | No — fixed height |
| Works where scripts are blocked | No | Yes |
| Tells your page about a submission | Yes | No |
| Lines of HTML | 2 | 1 |
Options you can set on the placeholder
All four are optional. data-seagit-height only sets the height before the first measurement arrives — after that the survey sizes itself — so it is worth setting only if you want to avoid a visible jump on a slow connection.
| Attribute | Default | What it does |
|---|---|---|
data-seagit-form | — | Your survey ID. Required. |
data-seagit-theme | auto | light, dark, or auto to follow the visitor's device setting. |
data-seagit-height | 320 | Starting height in pixels, before the survey reports its own. |
data-seagit-title | Form | The iframe's accessible title, read by screen readers. |
<div data-seagit-form="demo-poll" data-seagit-theme="light" data-seagit-height="480" data-seagit-title="Team poll" ></div> <script src="https://votense.com/embed.js" async></script>
auto follows the visitor, not your site
auto the survey follows the visitor's operating-system preference, which may not match your site. If your site is always light or always dark, say so explicitly with data-seagit-theme.Why is my embedded survey an empty box?
Nine times in ten it is the allowed-sites list in Settings → Embed. When that list is not empty and does not include the site doing the embedding, the browser refuses to load the frame before any of our code runs. Nothing can be rendered in its place, so the visitor sees a blank rectangle and no error appears anywhere — not in your console, not in ours.
An empty list means every site may embed the survey, which is why a freshly pasted snippet works with no configuration. The list is an opt-in restriction: the moment you add one entry, everywhere else is blocked.
Entries must match the origin exactly
frame-ancestors matches a scheme, host and port — not a page. https://example.com does not cover http://example.com, and http://localhost:3000 does not cover http://localhost:8080. Use *.example.com to cover subdomains, and write localhost with its scheme, as http://localhost:3000. You may list up to 20 sites.
Reacting to a submission on your own page
With the script embed, the survey tells your page when someone completes it, so you can fire your own analytics or move the visitor on. Two messages are sent: seagit:resize as the height changes, and seagit:submitted once. Both carry v: 1 so a future change to the format is recognisable rather than guessed at.
No answers ever cross that boundary — the messages carry a height and nothing else. Always check event.origin before acting on any message, as below, or another frame on your page could impersonate the survey.
window.addEventListener('message', function (event) {
if (event.origin !== 'https://votense.com') return;
if (event.data && event.data.type === 'seagit:submitted') {
// The visitor completed the form. Fire your own analytics, or redirect.
console.log('survey submitted');
}
});What respondents see
The embedded survey has no Votense navigation, header or footer — only your survey on a transparent background, plus a small “Powered by Votense” link that opens in a new tab so nobody loses a half-completed survey by clicking it. Submissions are stored, exported and forwarded to your webhooks and Slack channels exactly as they are from the hosted link. An embedded survey is the same survey, in a different place.
Common questions
- How do I embed a survey on my website?
- Copy the two-line script snippet from Settings → Embed and paste it into your page where the survey should appear. The first line is an empty div carrying your survey ID; the second loads embed.js, which finds the div and injects the survey. No account, framework or build step is needed on your side — it is plain HTML that works in any CMS that lets you paste an HTML block.
- What is the difference between the script and the iframe?
- The script resizes the survey automatically as fields expand and validation messages appear, so there is never an inner scrollbar. The plain iframe cannot do that — you set a fixed height and live with it. Use the script unless your host blocks scripts, which Notion and some locked-down CMS plans do.
- Why does my embedded survey show as an empty box?
- Almost always the allowed-sites list. If it is not empty and does not include the site doing the embedding, the browser refuses the frame before any Votense code runs, so nothing can be displayed in its place. Open Settings → Embed and either add that exact origin, including its scheme and port, or empty the list to allow every site.
- Do I need to add my domain before the embed works?
- No. An empty allowed-sites list means any site may embed the survey, so a freshly pasted snippet works immediately. The list only ever restricts: once you add one entry, every other site is blocked, so you must then list every place you embed the survey.
- Does the embedded survey match my site’s colours?
- It uses the accent you picked in Settings → Appearance, on a transparent background so your own page shows through. The theme defaults to auto, which follows the visitor’s operating-system setting inside the frame rather than your site’s theme. Set data-seagit-theme to light or dark to fix it.
- Can I embed a password-protected survey?
- Yes, with the same snippet — there is nothing extra to configure. The password gate renders inside the frame exactly as it does on the hosted page. The questions are not sent to the browser until the password is accepted: they are absent from the page source and from the embed’s server-rendered data, and even the survey’s name is withheld. A private survey embedded on a public page gives away nothing but its existence.