Ruby on Rails

Feedback widget
for Ruby on Rails.

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.

~12kb
gzipped
0
config
MIT
license
Install1 step
> app/views/layouts/application.html.erb· html
<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

Why teams shipping with Ruby on Rails pick Usero.

application.html.erb covers everything

Almost every Rails view renders inside the application layout. Adding the script there once means the widget appears across the whole app.

ERB passes the current user

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.

Importmap or esbuild, your call

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.

Turbo-aware

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.
vs Beamer embed

FAQ

Quick answers, Ruby on Rails edition.

Where do I put the script in Rails?

In app/views/layouts/application.html.erb, before </body>. The application layout wraps most views, so the widget then loads app-wide.

Importmap or esbuild?

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.

Can I attribute feedback to current_user?

Yes. Interpolate ERB into metadata, for example metadata: { userId: "<%= current_user&.id %>" }. The safe-navigation operator keeps it nil-safe when logged out.

Does it work with Turbo and Hotwire?

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.

Ship a feedback widget in your Ruby on Rails app today.

Free tier. No credit card. Two-minute install. Cancel by deleting two lines of code.

Get started free