x

Main chapters

  1. Get started
  2. Workspace
  3. Editor
  4. Question types
  5. Share
  6. Results
  7. Configuration
  8. Installation and updates
  9. Profile and personal settings
  10. Account and billing
  11. FAQs
  12. Development
 Actions

Embed your survey on a website

From LimeSurvey Manual

Embedding shows your survey inside a page of your own website, so visitors answer without leaving it. You copy a piece of code and paste it into the HTML of your page. The responses are stored in LimeSurvey, like all other responses.

On LimeSurvey Cloud, the Embed survey page of the new editor creates the code for you. Five embed modes decide how the survey appears:

Mode What visitors see Options
Standard The survey in your page, where you paste the code None
Pop-Up The survey in a window over your page Full screen on mobile, Trigger on... (Automatic, Scroll to section or On click), Window title, Width, Height
Widget A tab at the side of the page that opens the survey Full screen on mobile, Widget position (left-side or right-side), Widget Title
E-Mail A picture of the start of the survey in your email, linked to the survey None
Button A button that opens the survey Full screen on mobile, Custom icon, Button text, Font size, Rounded corners, Button color, Open in... (New window or Same window)

The Embed survey card on the Sharing overview shows four of the modes and calls Pop-Up Overlay.

Embedding works for surveys with the theme Fruity TwentyThree. For other themes, the Embed survey page says that embedding is not allowed for unsupported themes. See Themes.

Turn on embedding

Embedding is off by default for privacy and security reasons.

  1. Click Share in the top bar, then the gear in the left toolbar (1) and Embed survey (2).
  2. In the message Please keep in mind, click Enable embedding (3).
Embed survey in the Sharing options with numbered markers on the gear, Embed survey and the Enable embedding link in the Please keep in mind message

This sets Allow survey embedding to Yes in the Publication & access settings of the survey, and turns on Allow survey embedding for your whole survey site in Global settings ⇒ Security. A survey can only be embedded when both are on. See Publication & access.

In the classic editor, Allow survey embedding is in the Embedding part of the Publication & access settings. The embed code itself is created on the Share step of the new editor.

Choose a mode and set it up

Embed survey page with Pop-Up selected and numbered markers on Embed survey, the modes, the mode options, Update preview and Display code
  1. Under Embed survey options, click a mode (2).
  2. Set the options of the mode (3). Standard and E-Mail have none.
  3. Click Update preview (4) to see your latest changes in the preview below.

Copy the code

Click Display code (5). In the Embed code dialog:

  1. Click Copy (2). The code (1) is copied to your clipboard.
  2. Paste the code into the HTML of your page, at the place where the survey should appear. For E-Mail, paste it into the HTML editor of your email tool, for example Gmail, Zoho, Mailchimp or HubSpot.
Embed code dialog with numbered markers on the embed code and the Copy button
The code is visible in the source of your page, so anyone can copy it and show your survey on another site. Embed it only on sites you manage or trust.

Public registration doesn't work in an embedded survey: participants see the access code form instead of the registration form. To use public registration, share the survey link instead. See Share your survey link.

Turn embedding off

Set Allow survey embedding to No in the Publication & access settings of the survey. To turn it off for all surveys, set Allow survey embedding to No in Global settings ⇒ Security.

Embed the survey with an iframe

On your own installation, you embed a survey with an HTML <iframe> that loads the survey link.

  1. In the left sidebar, click Global settings and open the Security tab.
  2. Set IFrame embedding allowed to Allow and click Save. The default, Same origin, only allows iframes on pages of the same domain and port as your LimeSurvey. See Global settings.
  3. Copy the survey link. See Share your survey link.
  4. Paste an iframe with the link into the HTML of your page, for example:
<iframe src="https://survey.example.org/index.php/123456?lang=en" title="Customer feedback" width="100%" height="800" style="border: 0;"></iframe>

If your website runs on another domain than LimeSurvey, browsers block the LimeSurvey cookies inside the iframe, and participants can't submit the survey. Then you also need to change the session and CSRF cookie settings in config.php, and LimeSurvey must run on HTTPS. See Allow usage of session and CSRF validation in iFrame.

  Even with these settings, surveys in an iframe can fail in some browsers, for example in private browsing mode or when third-party cookies are blocked. If that is a problem, put a link or a button to the survey on your page instead.


Participants can answer an embedded survey only while it is active. See Activating a survey.

A plain survey link is the most reliable way for participants who use assistive technology or zoom their browser. See Create accessible surveys.

FAQ

Where are the responses of an embedded survey stored?

In LimeSurvey, like all other responses. In the new editor you see them under Results. See Responses.

Why does the preview not show my latest changes?

Click Update preview. The preview doesn't refresh on its own while you edit.

Can I put the survey in an email?

Yes, with E-Mail. The code shows a picture of the start of the survey. Recipients click it to open the survey in their browser.

See also