WaitlistContactUsIQ is in early access and provided as is. Use at your own risk.Join the waitlist

JavaScript embed

One script tag and one div. ContactUsIQ renders the form with your theme, loads Turnstile, submits by fetch and shows an inline thank-you.

Sample: samples/js-embed (index.html for the form, widget.html for the feedback widget, README).

The snippet

html
<div id="contactusiq-form"></div>
<script src="https://api.contactusiq.com/f/au_xxxxxxx/embed.js"
        data-target="#contactusiq-form" async defer></script>

GET /f/{formPublicId}/embed.js returns a script that renders the form with the workspace's chosen theme, loads Turnstile with the key configured on the form, submits by fetch with Accept: application/json and shows an inline thank-you with the reference id. It is cached at the edge.

Fields, labels, required rules and the Turnstile key all come from the form definition, so edits in the dashboard appear on the site without a deploy. No Turnstile site key is needed in the page.

Steps

  1. Put the div where the form should appear and the script tag after it (or anywhere on the page).
  2. Replace au_xxxxxxx with your form id.
  3. Keep data-target pointing at the div, or omit it to render where the script tag sits.
  4. Deploy on the verified domain.

Content Security Policy

If the site sets a CSP, allow:

script-src  https://api.contactusiq.com https://challenges.cloudflare.com
frame-src   https://challenges.cloudflare.com
connect-src https://api.contactusiq.com

The embed script is served with Subresource Integrity hashes.

Behaviour

  • Loads deferred and never blocks the host page if it fails to load.
  • Sets no cookies of its own.
  • On 429 shows the wait time from Retry-After; on 400 shows the field named in the error.
  • The same script family serves the feedback widget (widget.js), which adds intent, rating and page context.

Troubleshooting

SymptomCause and fix
The div stays emptyWrong form id (404 in the Network tab), the form is unpublished, or a CSP blocks api.contactusiq.com.
Submit returns 200 but nothing arrivesOrigin mismatch: the page is not on a verified domain of the form. Test on the real domain or add the staging domain to the workspace.
Turnstile fails inside the embedThe Turnstile widget in Cloudflare does not list this domain, or the key on the form is wrong.

Provide a fallback

Add a noscript paragraph with an email address or a link to a plain HTML version for visitors without JavaScript, or use the plain HTML form instead, which needs none.