Integrations
JavaScript SDK
Add one script tag to a web form for the richest fraud signals.
The SDK runs on your own survey page. It records how the form is filled in — time taken, mouse, touch and typing activity, copy-paste — which catches bots that a webhook can't see.
It also sends two signals a webhook can't collect:
- A device ID, from the open-source FingerprintJS library. SurveyGuard uses it to spot the same device answering your project again, or under several email addresses. On phones, where identical models can share an ID, the ID is recorded but not scored; repeat answers from phones are still caught by the IP and email checks.
- An automation check, from the open-source BotD library. It recognises headless browsers and automation tools such as Selenium, WebDriver and PhantomJS. Disguised automation can get past it, so it only ever lowers a score.
Both run in the respondent's browser. Only the device ID (a hash, not the browser details it was built from) and the automation verdict are sent to SurveyGuard, and the libraries' own usage statistics are switched off.
Install
Add this before </body> on the page with your form, using your publishable key:
<script
src="https://api.surveyguard.ca/sdk/v2/surveyguard.min.js"
data-api-key="sg_pk_your_publishable_key"
async></script>
That's it: the SDK attaches to every <form> on the page. When the form is submitted it scores the response, adds a hidden field _surveyguard_data (trust score, risk level, response ID) for your own records, then submits the form as normal.
Options
| Attribute | Default | Effect |
|---|---|---|
data-block-high-risk="true" | off | Stop high-risk submissions and show a short message instead |
data-risk-threshold="40" | — | With blocking on, block anything scoring below this number instead of only "High" |
data-show-warnings="false" | on | Silence console warnings |
data-device-fingerprint="false" | on | Don't send a device ID |
data-bot-detection="false" | on | Don't run the automation check |
data-ipqs-tracker="…" | — | Use an IPQS device tracker instead of the built-in device ID (ask support for your tracker URL) |
data-api-url="…" | script's own host | Only needed if you host the script elsewhere |
Or initialise it yourself:
<script src="https://api.surveyguard.ca/sdk/v2/surveyguard.min.js"></script>
<script>
SurveyGuard.init("sg_pk_your_publishable_key", { blockHighRisk: true, riskThreshold: 40 });
</script>
What it never does
- Never blocks a real respondent because of SurveyGuard. If SurveyGuard is unreachable, rate-limited or over quota, the form submits normally.
- Never sends sensitive fields. Passwords, hidden fields, card numbers, CVC/CVV, PINs, one-time codes and similar fields are skipped.
- Never exposes your fraud rules. The browser only learns the score, risk level and recommendation — not which checks fired.
Security
Add your survey's domain under Settings → Allowed domains so the key only works from your site. Publishable keys can only submit responses; they can't read data.