JavaScript snippet

The lowest-level way to load the widget — a script tag with no SDK or GTM.

Last reviewed

JavaScript snippet

This is the lowest-level way to load the widget. A single script tag, no package manager, no GTM, no SDK — just a URL and a browser global.

Most teams are better served by the Google Tag Manager, React SDK, or JavaScript SDK. Use the snippet when none of those fit your setup.

Add the script

HTMLindex.html
<scriptasyncsrc="https://cdn.getuserfeedback.com/widget/loader/v1/YOUR_API_KEY/loader.js"data-api-key="YOUR_API_KEY"></script>

Browser global

Once loaded, the widget exposes window.__getuserfeedback with the same capabilities as the SDK:

Main methods

  • flow(flowId).open()
  • flow(flowId).prefetch()
  • flow(flowId).prerender()
  • flow(flowId).close()
  • identify(identifyInput, traits?)
  • configure(updates)
  • reset()

Multi-instance helpers

If you run more than one instance on the same page:

  • instances() — list active instance IDs
  • use(instanceId) — target a specific instance

Open-request hook

onOpenRequested(callback) lets you observe open requests before the survey renders. Use it when your app needs to coordinate the opening behavior with its own UI.