JSPM

@sentry-internal/feedback

0.0.1-alpha
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6920807
  • Score
    100M100P100Q222065F
  • License MIT

Sentry SDK integration for user feedback

Package Exports

  • @sentry-internal/feedback
  • @sentry-internal/feedback/build/npm/cjs/index.js
  • @sentry-internal/feedback/build/npm/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sentry-internal/feedback) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sentry

Sentry Integration for Feedback

This SDK is considered experimental and in an alpha state. It may experience breaking changes, and may be discontinued at any time. Please reach out on GitHub if you have any feedback/concerns.

Pre-requisites

@sentry/feedback currently can only be used by browsers with Shadow DOM support.

Installation

Feedback can be imported from @sentry/browser, or a respective SDK package like @sentry/react or @sentry/vue. You don't need to install anything in order to use Feedback. The minimum version that includes Feedback is <>.

For details on using Feedback when using Sentry via the CDN bundles, see CDN bundle.

Setup

To set up the integration, add the following to your Sentry initialization. Several options are supported and passable via the integration constructor. See the configuration section below for more details.

import * as Sentry from '@sentry/browser';
// or e.g. import * as Sentry from '@sentry/react';

Sentry.init({
  dsn: '__DSN__',
  integrations: [
    new Sentry.Feedback({
      // Additional SDK configuration goes in here, for example:
      // See below for all available options
    })
  ],
  // ...
});

Lazy loading Feedback

Feedback will start automatically when you add the integration. If you do not want to start Feedback immediately (e.g. if you want to lazy-load it), you can also use addIntegration to load it later:

import * as Sentry from "@sentry/react";
import { BrowserClient } from "@sentry/browser";

Sentry.init({
  // Do not load it initially
  integrations: []
});

// Sometime later
const { Feedback } = await import('@sentry/browser');
const client = Sentry.getCurrentHub().getClient<BrowserClient>();

// Client can be undefined
client?.addIntegration(new Feedback());

Identifying Users

If you have only followed the above instructions to setup session feedbacks, you will only see IP addresses in Sentry's UI. In order to associate a user identity to a session feedback, use setUser.

import * as Sentry from "@sentry/browser";

Sentry.setUser({ email: "jane.doe@example.com" });

Loading Feedback as a CDN Bundle

As an alternative to the NPM package, you can use Feedback as a CDN bundle. Please refer to the Feedback installation guide for CDN bundle instructions.

Configuration

General Integration Configuration

The following options can be configured as options to the integration, in new Feedback({}):

key type default description
tbd boolean true tbd

Manually Sending Feedback Data

Connect your own feedback UI to Sentry's You can use feedback.flush() to immediately send all currently captured feedback data. When Feedback is currently in buffering mode, this will send up to the last 60 seconds of feedback data, and also continue sending afterwards, similar to when an error happens & is recorded.