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
<scriptasyncsrc="https://cdn.getuserfeedback.com/widget/loader/v4/YOUR_API_KEY/loader.js"data-api-key="YOUR_API_KEY"></script>If a flow should only display after the current app version supports a feature, send capabilities on the script tag:
<scriptasyncsrc="https://cdn.getuserfeedback.com/widget/loader/v4/YOUR_API_KEY/loader.js"data-api-key="YOUR_API_KEY"data-capabilities="checkout.drawer,messages.compose"></script>You can also pass JSON when you need extra metadata:
<scriptasyncsrc="https://cdn.getuserfeedback.com/widget/loader/v4/YOUR_API_KEY/loader.js"data-api-key="YOUR_API_KEY"data-capabilities='[{"key":"checkout.drawer","source":"host-app"}]'></script>See Capabilities.
Register actions
Assign custom actions and optional browser URL handling to
window.__getuserfeedback_actions before the Loader script. The Loader takes
one pre-bootstrap snapshot of this runtime-wide registry; it cannot be changed
after bootstrap or configured per instance. See
Actions for setup and behavior.
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(userId, traits?, options?)identify(traits, options?)identify(traits, undefined, options?)track(eventName, properties?, options?)configure(updates)reset()
configure(updates) accepts the same runtime updates as the SDK, including
capabilities:
<script>window.__getuserfeedback?.configure({capabilities: ["checkout.drawer", "messages.compose.v2"],});</script>Multi-instance helpers
If you run more than one instance on the same page:
instances()— list active instance IDsuse(instanceId)— target a specific instance
Open-request hook
onOpenRequested(callback) lets you observe explicit SDK and client-side
targeting opens before the flow renders. Use it when your app needs to coordinate
the opening behavior with its own UI. Server assignments and runtime broadcasts
are not intercepted.
Track events
Use track(eventName, properties?, options?) to record a product event from
the browser. See Events for property, external ID,
message ID, identity, and consent rules.