> For the complete documentation index, see [llms.txt](https://docs.zigpoll.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zigpoll.com/embed.md).

# Embed

Have questions about how to embed your Zigpoll? Look no further.

At the core of any non-Shopify Zigpoll implementation is the embed code. Find it by clicking **Installation** in the sidebar.

<figure><img src="https://1643988190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZpanNFqg3aCUZgXh3X%2Fuploads%2FvpE1y7YouY7HCzUOYJyB%2Fimage.png?alt=media&amp;token=2d598139-12b4-4f24-b635-47d1f8673bbd" alt=""><figcaption></figcaption></figure>

If you copy and paste that code into the **\<head>** tag of your website, you are all set.

The embed code looks something like this:

```javascript
<script type='application/javascript'>
  ;(function () {
    window.Zigpoll = {
      accountId: 'YOUR_ACCOUNT_ID'
    };

    var script = document.createElement("script");
    script.type = "text/javascript";
    script.charset = "utf-8";
    script.src = "//cdn.zigpoll.com/static/js/main.js";
    script.async = true;

    document.head.appendChild(script);
  }());
</script>
```

{% hint style="info" %}
**YOUR\_ACCOUNT\_ID** will be replaced the id for your particular account.
{% endhint %}

{% hint style="info" %}
[Contact us](mailto:support@zigpoll.com) if you need help installing the embed code. For paid plans we offer end to end installation support.
{% endhint %}

If you're on a site builder like Framer, Wix, or Webflow - see [Integrations](/integrations.md) for more detailed instructions on implementing Zigpoll into your platform.

#### Single Page Web Apps

If you have a single page webapp you can still use Zigpoll. All you need to do is run the following code immediately **after** you change a page within your app.

```
window.Zigpoll.refresh();
```

#### Load a specific survey by ID

If you want to load a specific survey on a particular page, you can do so by adding a parameter called **pollId** to the Zigpoll object. Find the ID on the survey's **Settings → General → Survey Id**. For example:

```
<script type='application/javascript'>
  ;(function () {
    window.Zigpoll = {
      accountId: 'YOUR_ACCOUNT_ID',
      pollId: 'YOUR_SURVEY_ID'
    };

    var script = document.createElement("script");
    script.type = "text/javascript";
    script.charset = "utf-8";
    script.src = "//cdn.zigpoll.com/static/js/main.js";
    script.async = true;

    document.head.appendChild(script);
  }());
</script>
```

This loads the survey with id **YOUR\_SURVEY\_ID** and overrides the page rules on **Settings → Delivery → Locations** and the rules on **Settings → Targeting**. The survey still has to be live. For the full list of what still applies, see [Which settings still apply](/javascript-api.md#which-settings-still-apply).

## Inline Embedding

Zigpoll supports two methods for embedding a survey directly into your page content. Both render the survey inline rather than as a popup or slide-in widget.

To use either, open the survey, go to **Settings → Delivery → Format**, choose **Page Embed**, and pick a method under **Embed Settings**.

### Copy & Paste Snippet

This is the simplest way to embed a survey. It is a single, self-contained code block that you paste wherever you want the survey to appear. No global embed script is required, and page rules are bypassed — the survey loads exactly where you place the snippet.

You can find this snippet under **Settings → Delivery → Format → Embed Settings → Copy & Paste Snippet**.

```html
<div id="zigpoll-embed-YOUR_POLL_ID"></div>
<script type="application/javascript">
  ;(function () {
    window.Zigpoll = window.Zigpoll || {};
    window.Zigpoll.accountId = 'YOUR_ACCOUNT_ID';
    window.Zigpoll.pollId = 'YOUR_POLL_ID';
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.charset = "utf-8";
    script.src = "//cdn.zigpoll.com/static/js/main.js";
    script.async = true;
    document.head.appendChild(script);
  }());
</script>
```

{% hint style="info" %}
**YOUR\_ACCOUNT\_ID** and **YOUR\_POLL\_ID** will be pre-filled with the correct values when you copy the snippet from the dashboard.
{% endhint %}

### CSS Selector

This method uses the global embed script (installed in your `<head>` tag as described above) together with a container element on the page that matches a CSS selector you configure.

1. Make sure the **global embed code** is installed in your site's `<head>` tag.
2. Add a container element on the page where you want the survey to appear:

```html
<div id="zigpoll-embed-target"></div>
```

3. Under **Settings → Delivery → Format → Embed Settings**, choose **CSS Selector** and set **Selector** to match the container (e.g. `#zigpoll-embed-target`).

With this method, page rules and display settings are still respected, giving you centralized control over when and where the survey appears.

If no element matches the selector, Zigpoll also looks for `#zigpoll-embed-target` and `#zigpoll-embed-` followed by the survey ID before giving up.

### Which method should I use?

|                | Copy & Paste Snippet                                                          | CSS Selector                                                                      |
| -------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| **Setup**      | Paste one code block — done                                                   | Install global script + add a container element + configure selector in dashboard |
| **Page rules** | Bypassed — survey always loads where the snippet is placed                    | Respected — survey follows your delivery settings                                 |
| **Best for**   | Landing pages, page builders, or placing multiple surveys on one page quickly | Sites where you want centralized control over display rules and visibility        |

### Multiple surveys on one page

Both methods support placing multiple surveys on a single page.

* **Copy & Paste Snippet**: Each snippet is fully independent. Paste as many snippets as you need — each one loads its own survey.
* **CSS Selector**: Use a unique selector for each survey (e.g. `#zigpoll-survey-1`, `#zigpoll-survey-2`) and configure each survey's delivery settings to point to its own container.

### One survey, one format

A survey has a single delivery format, so the same survey can't be both a pop-up and a page embed. Duplicate the survey and give each copy its own format.

### Styling an embedded survey

Zigpoll draws the survey inside its own frame, so CSS on your page doesn't reach it. Style it on **Settings → Design**, or add rules under **Custom CSS** there.

### Troubleshooting

If an embed doesn't appear, see [My embedded survey isn't showing up](/faq/embedding-surveys-on-specific-pages.md#my-embedded-survey-isnt-showing-up).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zigpoll.com/embed.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
