Embed Code
2 min read
Definition
An embed code is a snippet of HTML, JavaScript, or iframe markup that you paste into a webpage to display third-party content, such as a form, video, map, or widget, directly on your site without leaving the page.
How It Works
<script src="https://wittyform.com/embed.js" data-form-id="abc123"></script>
When a visitor loads your page, the browser fetches the external script or iframe, which renders the form inline. The form inherits your page's styling context but runs independently.
Types of Embeds
| Type | Pros | Cons |
|---|---|---|
| Iframe | Fully isolated, easy to implement | Limited style control, fixed height issues |
| JavaScript | Flexible styling, auto-resizes | Requires script execution |
| Popup / Modal | Does not take page space, triggered on action | Can be blocked by popup blockers |
| Web Component | Native encapsulation, modern approach | Requires browser support |
Why It Matters for Forms and Surveys
- No coding required: paste a snippet and your form appears on any page.
- Maintain visitor context: embedded forms keep users on your site instead of redirecting to a third-party URL.
- Higher conversion rates: reducing page jumps typically increases form completion.
- Centralized management: update the form in your builder and changes appear everywhere it is embedded.
Related Terms