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

NameTypeWhat it does
data-keyrsp_pk_…Your publishable key. Required.
data-surveystringThe survey to run. Required.
data-emailstringWho is answering, if you know it when the page renders.
data-namestringTheir name, likewise.
data-headlessflagSuppress 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.

NameTypeWhat it does
identify(person)voidSay who is answering: email, name and any traits. Read when the response is sent, so calling it after the survey opens still counts.
show()voidOpen the survey now, ignoring the delay, targeting and the once-only rule. For a “Give feedback” button.
reset()voidForget that this browser answered, so the survey can show again.
headless(handler)voidReceive the survey session to render yourself. Pair it with data-headless.
badge(options)HTMLAnchorElementThe “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 },
});
NextTyped client