Add the website widget to your site
The website widget shows one of your surveys on your own site or in your product: as a small card in a corner, a tab on the edge of the page, or a Spotlight in the middle of the page. You choose the pages, the moment and how often each visitor is asked. It’s on the Team plan and up.
There are two parts:
- A Website, set up once in Workspace settings › Websites. It holds the domains the widget may appear on and gives you one snippet for the whole site.
- A Website widget for each survey, made on the survey’s Distribute page. It says which Website, which pages, when and how often.
Add a Website
Section titled “Add a Website”- Go to Workspace settings › Websites and click Add Website.
- Give it a name, such as “Marketing site”.
- List the domains the widget may appear on, one per line:
example.com,www.example.com.*.example.comcovers every subdomain of example.com but not example.com itself, so list both if you need both. The survey only opens inside pages on these domains. - Click Add Website.
The Website’s identity secret is shown once, straight after you add it. You only need it to link answers to known visitors. Copy it now if you plan to; you can make a new one later.
Install the snippet
Section titled “Install the snippet”Copy the snippet from the Website and paste it into every page, before </body>. It looks like this:
<script>window.SurveyRock=window.SurveyRock||function(){(SurveyRock.q=SurveyRock.q||[]).push(arguments)};</script><script async src="https://media.surveyrock.com/widget/v1/loader.js" data-site="ws_…"></script>Google Tag Manager: add the snippet as a Custom HTML tag that fires on All Pages.
You install the snippet once. Everything else (which survey, which pages, when) is changed in SurveyRock and reaches your site within about a minute, with no new deploy on your side.
If your site sends a Content Security Policy, see Content Security Policy for the website widget. If it waits for cookie consent, see The website widget and cookie consent.
Check it’s installed
Section titled “Check it’s installed”On the Website, click Check installation, then open any page of your site. Within 15 minutes of the click, the Website shows when and where the snippet was last seen.
Make the widget
Section titled “Make the widget”- Open the survey’s Distribute page, click Add Channel and choose Website Widget.
- Choose the Website, the format and when it shows. When the widget shows, and how often explains every option.
- Check it in the preview (below), and on your own site if you like.
- Click Save.
Formats
Section titled “Formats”- Corner card: a card in the bottom right or bottom left corner. The default.
- Edge tab: a button on the right or left edge of the page that opens the survey when a visitor clicks it.
- Spotlight: the survey in the middle of the page, with the rest of the page dimmed. It gets the most answers and interrupts the most, so choose a trigger that waits, such as time on the page or scrolling, rather than When the page loads. The panel warns you if you don’t.
Each answer records the format it came from, so you can compare answer rates by format.
How it looks
Section titled “How it looks”The card around the survey follows the survey’s theme: its background, corners and colours, light or dark. The card’s own text (the minimized button, the tab and the preview label) uses your site’s font. The survey inside keeps its theme’s font; you choose that in the survey’s theme.
Dark-mode theme: choose a theme to show instead of the survey’s own when a visitor’s device is set to dark mode. It applies to this widget only: the survey’s link and email invitations keep its own theme.
Close the card after the thank-you screen (on by default): the card closes itself 5 seconds after the thank-you screen appears. It waits while the visitor’s pointer or keyboard is in the card, and it never closes itself when the thank-you screen has a link or button of your own, such as a download or a redirect.
Preview
Section titled “Preview”The preview in the panel shows your real survey in the widget on a sketch of a page. You can answer it: preview answers aren’t saved as responses and count nothing. Switch between Desktop and Phone to see both layouts, and between Light and Dark once you’ve chosen a dark-mode theme. Start again takes the survey back to its first page.
Preview on your site
Section titled “Preview on your site”To see the widget on your own page before it’s live:
- Under Preview on your site, enter the address of a page on the chosen Website, such as
https://www.example.com/pricing. - Click Preview on my site. The page opens in a new tab with the widget showing at once, as set in the panel (saved or not), whatever its trigger. A small Preview label shows it’s a preview.
The page needs the snippet. The survey inside is its preview, so nothing is counted and nothing is stored in the visitor’s browser. Copy link gives you the same address to send to a colleague. The link works for 24 hours.
A widget goes live with the survey. A survey with a verification (Captcha) question can’t be shown in a widget, and the widget isn’t available in a workspace in PHI mode.
What visitors get
Section titled “What visitors get”The widget appears once the survey inside it has loaded, so visitors never see an empty card. If the survey hasn’t loaded after 8 seconds, the widget doesn’t appear on that page and isn’t counted as shown.
Corner card and edge tab
- They never take focus away from the page. Screen readers announce the card once, politely, and it’s a named region visitors can reach with the keyboard.
- Escape or the close button closes it, and focus goes back to where the visitor was.
- The – button minimizes the card to a small button named after the survey. It stays minimized as the visitor moves between pages of your site, and pressing it opens the survey again with focus inside it.
- If something the visitor focuses on the page would sit under the card, the card shrinks out of the way.
Spotlight
- It’s a dialog: focus moves into the survey when it appears and stays inside it until the visitor answers, minimizes or closes it.
- Escape, the close button or a click on the dimmed page closes it, and focus goes back to where the visitor was.
On phones, the card and Spotlight open as a sheet at the bottom of the screen, full width and at most half the screen high, with the survey scrolling inside it. The page above stays readable. The edge tab stays as it is.
The widget respects a visitor’s reduced-motion setting.