Add the SDK via importmap or a script in application.html.erb.
Rails ships HTML from ERB views, so the widget is a client-side add-on. The simplest path is a script tag in application.html.erb; if you use importmaps, you can pin the SDK and import it from a Stimulus controller instead.
<body>
<%= yield %>
<script src="https://unpkg.com/@usero/sdk"></script>
<script>
Usero.initUseroFeedbackWidget({
clientId: "YOUR_CLIENT_ID",
metadata: { userId: "<%= current_user&.id %>" }
});
</script>
</body>Replace YOUR_CLIENT_ID with the id from your Usero dashboard.
Built for Ruby on Rails
Almost every Rails view renders inside the application layout. Adding the script there once means the widget appears across the whole app.
Interpolate current_user&.id into metadata so feedback is attributed to the logged-in user. Use the safe-navigation operator to avoid nil errors when logged out.
On importmaps, pin @usero/sdk and import it from a Stimulus controller. On jsbundling-rails with esbuild, import it from application.js. The CDN tag avoids both.
Rails apps with Turbo do not full-reload. Initialize once and the widget persists, or hook turbo:load if you scope the init to a controller.
Beamer needs a script plus dashboard setup before it shows. The vanilla SDK renders its trigger from the init call in your layout alone.
FAQ
In app/views/layouts/application.html.erb, before </body>. The application layout wraps most views, so the widget then loads app-wide.
Either. With importmaps, pin @usero/sdk and import it in a Stimulus controller. With esbuild via jsbundling-rails, import it in application.js. The CDN script needs neither.
Yes. Interpolate ERB into metadata, for example metadata: { userId: "<%= current_user&.id %>" }. The safe-navigation operator keeps it nil-safe when logged out.
Yes. With Turbo navigations the page does not full-reload, so a single init persists. If you scope init to a Stimulus controller, hook turbo:load instead.
Free tier. No credit card. Two-minute install. Cancel by deleting two lines of code.
Install guides