Skip to content

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 or a tab on the edge 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:

  1. 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.
  2. A Website widget for each survey, made on the survey’s Distribute page. It says which Website, which pages, when and how often.
  1. Go to Workspace settings › Websites and click Add Website.
  2. Give it a name, such as “Marketing site”.
  3. List the domains the widget may appear on, one per line: example.com, www.example.com. *.example.com covers 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.
  4. 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.

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.

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.

  1. Open the survey’s Distribute page, click Add Channel and choose Website Widget.
  2. Choose the Website, the format (corner card or edge tab) and when it shows. When the widget shows, and how often explains every option.
  3. The preview in the panel shows how it looks. It doesn’t load the survey, so it counts no views.
  4. Click Save.

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.

  • The card never takes focus away from the page. Screen readers announce it 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.
  • If something the visitor focuses on the page would sit under the card, the card shrinks out of the way.