Gatsby

Feedback widget
for Gatsby.

Mount once in gatsby-browser.js wrapPageElement. Survives client routing.

Gatsby prerenders every page to static HTML, so the widget belongs in the browser-only lifecycle. wrapPageElement in gatsby-browser.js runs on the client and keeps the widget mounted across Gatsby Link navigations.

~12kb
gzipped
0
config
MIT
license
Install2 steps
> ~ install· bash
npm install @usero/sdk
> gatsby-browser.js· js
import { initUseroFeedbackWidget } from '@usero/sdk'

let widget

export const onClientEntry = () => {
  widget = initUseroFeedbackWidget({ clientId: 'YOUR_CLIENT_ID' })
}

// HMR-safe teardown in dev
if (import.meta.webpackHot) {
  import.meta.webpackHot.dispose(() => widget?.destroy())
}

Replace YOUR_CLIENT_ID with the id from your Usero dashboard.

Built for Gatsby

Why teams shipping with Gatsby pick Usero.

gatsby-browser.js is client-only

Code in gatsby-browser.js never runs during the SSG build. The widget boots after the static HTML hydrates, so prerendering stays untouched.

onClientEntry runs once

It fires a single time when the app first loads, which is exactly when you want to create the widget. No per-page wiring.

Persists across Gatsby Link

Because the init happens at the app level, the widget stays mounted through every client-side route change, not torn down per page.

No gatsby-node config

This is purely a browser concern. You do not touch gatsby-node.js, GraphQL, or the build pipeline.

Frill ships an iframe that reloads on every client navigation. The vanilla SDK mounts once in onClientEntry and survives Gatsby Link transitions.
vs Frill iframe

FAQ

Quick answers, Gatsby edition.

Why gatsby-browser.js and not a React component?

A component in a page template would remount on every navigation. onClientEntry in gatsby-browser.js runs once at app start, so the widget lives for the whole session.

Does it break the static build?

No. gatsby-browser.js code is excluded from the SSG build and only runs in the browser, so prerendered HTML is unaffected.

Can I use the React component instead?

Yes, render UseroFeedbackWidget from @usero/sdk/react inside wrapRootElement in gatsby-browser.js if you prefer the component form.

Will it work with Gatsby Cloud or Netlify hosting?

Yes. The widget runs entirely client-side, so the host that serves your static files is irrelevant to it.

Ship a feedback widget in your Gatsby app today.

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

Get started free