Script tag
One tag on the pages you want to ask on. It loads the survey, checks targeting, sampling, the delay and the once-only rule, and opens the card if they all apply.
Add the tag
Paste it before </body>. Each survey’s page in Respondo gives you this snippet with your key and its id filled in.
index.html
<script src="https://app.myrespondo.com/embed.js"
data-key="rsp_pk_…"
data-survey="…"
defer></script>The publishable key is meant to be public: it can load that survey and send answers to it, and nothing else.
Attributes
| Name | Type | What it does |
|---|---|---|
| data-key | rsp_pk_… | Your publishable key. Required. |
| data-survey | string | The survey to run. Required. |
| data-email | string | Who is answering, if you know it when the page renders. |
| data-name | string | Their name, likewise. |
| data-headless | flag | Suppress the built-in card and hand the survey to your own UI instead. See Your own UI. |
window.Respondo
Once the tag has run, it leaves a small API on the window for anything you decide after the page renders.
| Name | Type | What it does |
|---|---|---|
| identify(person) | void | Say who is answering: email, name and any traits. Read when the response is sent, so calling it after the survey opens still counts. |
| show() | void | Open the survey now, ignoring the delay, targeting and the once-only rule. For a “Give feedback” button. |
| reset() | void | Forget that this browser answered, so the survey can show again. |
| headless(handler) | void | Receive the survey session to render yourself. Pair it with data-headless. |
| badge(options) | HTMLAnchorElement | The “Powered by Respondo” lockup, for your own UI. |
after sign-in
window.Respondo.identify({
email: user.email,
name: user.name,
traits: { plan: "team", userId: user.id },
});