# Embed

Source: https://docs.rooquiz.com/en/publish/embed

> Embed a quiz directly into your own site so visitors answer without leaving the page: the available embed modes, the code each one generates, and which mode suits which kind of page.

Beyond sharing a link, you can **embed a quiz directly into your own website** — visitors complete it on your landing page without leaving.

## Three embed modes

Open **Share** → **Embed** on the target quiz, pick a display mode, then copy the generated code into your site's HTML.

| Mode                            | Best for                                             | Behavior                                              |
| ------------------------------- | ---------------------------------------------------- | ----------------------------------------------------- |
| **Inline (auto height)**        | Blending into the page content flow                  | Height follows the content automatically. Recommended |
| **Popup**                       | A call-to-action button on your page                 | Opens the quiz in a full-screen overlay               |
| **Plain iframe (fixed height)** | Environments where loading a script is not an option | Simplest; fixed height with inner scrolling           |

### Inline (auto height)

```html
<div data-rooquiz-embed data-rooquiz-token="YOUR_QUIZ_TOKEN"></div>
<script src="https://YOUR_QUIZ_DOMAIN/embed.js" async></script>
```

The embed script watches the quiz content height (pagination, navigating to the result page, etc.) and resizes the iframe in real time — no scrollbars, no clipping.

### Popup

```html
<div data-rooquiz-embed data-rooquiz-token="YOUR_QUIZ_TOKEN" data-rooquiz-mode="popup" data-rooquiz-text="Start the quiz"></div>
<script src="https://YOUR_QUIZ_DOMAIN/embed.js" async></script>
```

A button is rendered on your page; clicking it opens the quiz in a full-screen overlay. Close with ESC or by clicking the mask.

### Plain iframe

```html
<iframe src="https://YOUR_QUIZ_DOMAIN/a/YOUR_QUIZ_TOKEN?embed=1" width="100%" height="600" style="border:0;" title="RooQuiz"></iframe>
```

The iframe always points at the quiz's stable `/a/<token>` address, not its custom path, so changing the custom path later never breaks embed code that's already on your site.

## The "Made with RooQuiz" line

On the **Free plan**, embeds keep a small **Made with RooQuiz** credit line. It sits **outside the iframe**, on your page: inline and popup embeds render it automatically through `embed.js`, and the plain iframe code includes it as a `<p>` right below the iframe — keep it there. On **Pro**, the generated code leaves it out.

## Available attributes

| Attribute                   | Description                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data-rooquiz-token`        | Required. The quiz public token                                                                                                                                                                                                                                                                                                                                                                            |
| `data-rooquiz-mode`         | `inline` (default) or `popup`                                                                                                                                                                                                                                                                                                                                                                              |
| `data-rooquiz-utm-source`   | UTM source recorded with every response, used by [UTM Source Tracking](https://docs.rooquiz.com/en/publish/tracking) and the source breakdown in [Insights](https://docs.rooquiz.com/en/results/insights)                                                                                                                                                                                                                                                  |
| `data-rooquiz-utm-medium`   | UTM medium (optional)                                                                                                                                                                                                                                                                                                                                                                                      |
| `data-rooquiz-utm-campaign` | UTM campaign (optional)                                                                                                                                                                                                                                                                                                                                                                                    |
| `data-rooquiz-height`       | Initial height (px) for inline mode, used before auto-resize kicks in                                                                                                                                                                                                                                                                                                                                      |
| `data-rooquiz-text`         | Button label for popup mode                                                                                                                                                                                                                                                                                                                                                                                |
| `data-rooquiz-track`        | `auto`: also fire the Meta and TikTok pixels already on your page (see [Conversion events](#conversion-events))                                                                                                                                                                                                                                                                                            |
| `data-rooquiz-pass`         | Comma-separated [URL parameters](https://docs.rooquiz.com/en/publish/tracking#url-parameters-hidden-fields) to copy from your page's address into the quiz, e.g. `partner,campaign_id` (add `email,name` to prefill the lead form). With the JS API, pass `params: { partner: 'acme' }` to set values directly After changing the quiz's URL parameters, copy the embed code again — code already on your site keeps the old list. |

If you don't set the UTM attributes, any `utm_*` parameters on the host page's URL are passed through automatically.

## Conversion events

On **Pro**, inline and popup embeds pass the quiz's conversion events — quiz started, lead captured, quiz completed, CTA clicked and more — to your page. Each one is pushed to your page's `dataLayer` as `rooquiz_<event>` (for your own Google Tag Manager) and dispatched as a `rooquiz:<event>` browser event. Add `data-rooquiz-track="auto"`, or turn on **Also fire my page's Meta and TikTok pixels** in the embed panel, to send them straight to the pixels already installed on your page. With the JS API, pass `track: 'auto'`.

A plain iframe can't pass events. See [Ad Tracking Pixels](https://docs.rooquiz.com/en/publish/ad-pixels#embedded-quizzes) for the full event list.

## JS API

When you need a custom trigger (e.g. your own designed button opening the popup), call the API directly:

```html
<script src="https://YOUR_QUIZ_DOMAIN/embed.js"></script>
<script>
  // Mount an inline embed manually
  RooQuiz.embed({ el: '#container', token: 'YOUR_QUIZ_TOKEN', utmSource: 'homepage' })
  // Open the popup from any element
  document.querySelector('#my-button').onclick = () => RooQuiz.open('YOUR_QUIZ_TOKEN', { utmSource: 'homepage' })
</script>
```

<Callout type="info">
  The embedded page automatically hides the footer and background, blending transparently into your site; your theme colors still apply. Responses collected through embeds appear in [Response Records](https://docs.rooquiz.com/en/results/records) as usual.
</Callout>
