Skip to main content
For plain TypeScript or JavaScript, Vue, Svelte or any web app without a dedicated Lerix package, use @lerix-dev/lerix-core 1.4.0 or later. It is the engine behind the React, Next.js and Angular SDKs, and it also reports errors. For what each module does and what you see in the dashboard, read Feedback, NPS surveys and Analytics.
@lerix-dev/lerix-js, the package on the Web push page, covers push notifications only. Feedback, NPS and analytics live in @lerix-dev/lerix-core. Using React, Next.js or Angular? Use React, Next.js or Angular instead.

Setup

main.ts

In-app feedback

The dialog (message, labels, screenshot with pen annotation, email, review with Show details, thanks) renders inside a Shadow DOM, so your CSS can’t reach it and it can’t break your layout. The UI and the screenshot library are a separate entry point (@lerix-dev/lerix-core/feedback), loaded only when the dialog or the NPS card is first used, so bundlers put them in their own chunk. Override the dashboard settings for one call:

Hide sensitive content

Add data-lerix-mask to any element to black it out of screenshots:
The dialog also offers pixel-perfect capture, which uses the browser’s screen-share prompt to capture canvas, video and cross-origin content exactly.

Your own form

Feedback is queued in IndexedDB (with a localStorage fallback) and retried until the server accepts it. status is queued and id is missing while the browser is offline.

NPS survey

A card slides up from the bottom: a 0 to 10 score, a follow-up question for the score’s group, then thanks. On the web, an “app start” is a new session, so minAppStarts counts visits after 30 minutes of inactivity. See When the survey is shown. In debug mode, the console says why a survey was skipped.

Analytics

  • $first_open, $session_start / $session_end (per tab, a new session after 30 minutes of inactivity), $app_update (when release changes) and $screen_view (from pushState, replaceState and popstate) are recorded automatically.
  • If your router doesn’t change the URL, or you want cleaner names, call Lerix.analytics.disableAutoScreens() and record screens yourself with Lerix.screen().
  • track and screen never throw. Invalid events and properties are dropped on the device.
  • Events are batched and sent with fetch(..., { keepalive: true }) when the tab is hidden, so the last events of a visit aren’t lost.
  • Lerix.analytics.getSessionId() returns the current session ID, which error reports also carry.
Call Lerix.setUser after sign-in. Analytics then counts the person across devices, and you can reply to their feedback by push.
The last 50 breadcrumbs (navigation is added automatically) are attached to feedback. Categories: navigation, log, http, ui, custom.