Docs

Embed a survey on your website

Last updated October 19, 2026

Put a survey on your own site: inline in a page, as a popup or slide-in, or behind a feedback tab. Get the code for a survey from Share → Embed on your website. Inline embeds work on every plan; popups, slide-ins and the feedback tab are on Pro and above.

1.Inline

The survey sits in the page and grows to fit it. Put the div where it should appear and the script once per page.

Inline
<div data-survey="SURVEY_ID"></div>
<script src="https://hearsay.co.in/e/v1/embed.js" async></script>

2.Popup, slide-in and feedback tab

One script tag. It loads the survey only when it opens, so visitors who never see it cost nothing.

Popup when visitors scroll halfway, at most every 30 days, on checkout pages
<script src="https://hearsay.co.in/e/v1/embed.js"
  data-survey="SURVEY_ID" data-mode="popup" data-trigger="scroll:50"
  data-frequency="days:30" data-include="/checkout/*" async></script>

3.Options

data-mode
inline, popup, slider or tab.
data-trigger
delay:10 (seconds), scroll:50 (% of the page), exit (about to leave, desktop only), load, or manual (only from your code). Default delay:5.
data-frequency
always, session, days:30 or once. Default days:30.
data-after-submit
hide (never open on its own again) or days:90. Default hide.
data-sample
Show to this % of visitors, decided once per visitor.
data-include / data-exclude
Paths, comma-separated, with * as a wildcard: /checkout/*
data-source
One of the survey’s channels, so responses count under it. Default: Website embed.
data-hidden-<field>
A value for a link field, e.g. data-hidden-plan="pro".
data-position, data-label, data-color
Where the slide-in or tab sits, and the tab’s text and colour.

4.From your code

Logged-in apps can pass visitor details and open the survey on their own events. Commands queue until the script loads.

JavaScript
<script>
  window.SurveyEmbed = window.SurveyEmbed || [];
  // Open it on your own event, with details about the visitor:
  SurveyEmbed.push(['open', 'SURVEY_ID', { mode: 'popup', hidden: { email: user.email, plan: 'pro' } }]);
  // Hear when someone finishes (no answers are shared with your page):
  SurveyEmbed.push(['on', 'submit', function (e) { console.log('answered', e.survey); }]);
</script>

5.What is shared

The page address (without its query string, except utm_ tags) is saved with each response, so you can tell which page it came from. Values you pass go after the # in the survey address, so they never reach a server log. Your page never sees answers or coupon codes.

Browsers keep embedded pages’ storage separate per site, so “one response per device” applies per site. The script remembers on your site who already answered and won’t ask them again.

6.Content Security Policy

If your site sends a Content-Security-Policy header, allow https://hearsay.co.in in script-src and frame-src.

7.Help

Questions about embeds? Email support@hearsay.co.in. We reply within one business day.