Open a Survey
Trigger flows intentionally from the SDK, React hooks, or the loader global API.
- Last reviewed
Open a Survey
Open feedback from places in your product where the intent is obvious: a help menu, a feedback button, or a specific milestone.
JavaScript SDK
await client.flow("YOUR_FLOW_ID").open();
React SDK
import { useFlow } from "@getuserfeedback/react";
function FeedbackButton() {
const { open } = useFlow({ flowId: "YOUR_FLOW_ID" });
return <button onClick={() => void open()}>Send feedback</button>;
}
Use hooks like useFlow inside components rendered under
GetUserFeedbackProvider.
Loader or GTM
window.__getuserfeedback?.flow("YOUR_FLOW_ID").open();
Make opening feel fast
If the flow is likely to open after hover, focus, or some predictable action, prefetch and prerender it first.
const run = client.flow("YOUR_FLOW_ID");
await run.prefetch();
await run.prerender();
await run.open();
The common mistake
Do not call open() before the widget is initialized. If you use
disableAutoLoad, wait until you have called client.load() before opening the
flow.