Docs

Submitting Feedback

Submit feedback, bug reports, and ratings with options and metadata

Last updated:

Basic Feedback

Submit feedback with a selected option:

typescript
await SessionSightFeedback.submit('bug-report', {
  sessionId: currentSessionId,
  option: 'critical',
});

The feedbackTypeId must match a feedback type slug that exists in your SessionSight dashboard. sessionId is required on every submit. On servers pairing with the Insights SDK, forRequest(req) reads ss_sid off the inbound request so you don’t have to thread it manually.

Full Example

Include message and metadata for richer context:

typescript
await SessionSightFeedback.submit('bug-report', {
  sessionId: currentSessionId,
  option: 'critical',
  message: 'The checkout page crashes on Safari',
  metadata: {
    page: '/checkout',
    browser: 'Safari 17',
  },
});

Use as Ratings

Feedback types are flexible enough to serve as rating systems. Define options that represent your scale, then submit the user’s selection.

Star Ratings (1 to 5)

Create a feedback type called “Star Rating” with options: 1, 2, 3, 4, 5.

typescript
await SessionSightFeedback.submit('star-rating', {
  sessionId: currentSessionId,
  option: '4',
});

Sentiment (Good / Neutral / Bad)

Create a feedback type called “Page Feedback” with options: good, neutral, bad. Enable text input for optional comments.

typescript
await SessionSightFeedback.submit('page-feedback', {
  sessionId: currentSessionId,
  option: 'good',
  message: 'This article was really helpful!',
});

API Reference

SessionSightFeedback.submit(feedbackTypeId, options?)

ParameterTypeDefaultDescription
feedbackTypeIdstringrequiredFeedback type slug from your dashboard
options.sessionIdstringrequiredSession the feedback belongs to. Visitor and user identity are resolved from the session on the backend. Use forRequest(req) to auto-attach from the ss_sid cookie.
options.optionstring-Selected option value (must match a pre-defined option)
options.messagestring-Free-text message (only if feedback type allows text input)
options.metadataRecord<string, string>-Key-value context

Return Type

typescript
interface FeedbackResult {
  success: boolean;
  error?: string;
}