The Web Ratings
Going Deeper

Configuration Options

Configuration options supported by the widget

The following options are actually implemented in the current widget. Pass them to TheWebRatings.init({ ... }).

Minimal

<script>
  TheWebRatings.init({ apiKey: 'your-api-key' });
</script>

Top-Level Options

OptionTypeDescription
apiKeystringRequired. Your TheWebRatings API key.
mode'production' | 'demo'Optional. Default 'production'. Use 'demo' for docs/playgrounds; no backend calls, data in localStorage.
debugbooleanOptional. Enable debug logging. Default false.
appNamestringOptional. Override app name (defaults to API response).
platform'auto' | 'web' | ...Optional. Default 'auto' (detected).
colorsobjectOptional. See Colors below.
featuresobjectOptional. See Features below.
autoPromptobjectOptional. See Auto-Prompt below.

Deprecated: userEmail and userName on init() are deprecated. Pass user data when opening: TheWebRatings.open(email, name).

Colors

Only these keys and properties are used. Omit any key to use the default.

colors: {
  button: { background?, text?, hover? },
  textarea: { border?, focus?, background? },
  stars: { filled?, empty? },
  modal: { background?, backdrop? }
}
  • button: background, text, hover — primary button styling.
  • textarea: border, focus, background — review textarea.
  • stars: filled, empty — star rating colors.
  • modal: background — bottom sheet background; backdrop — overlay behind the sheet.

All values are CSS colors (e.g. '#D97706', 'var(--my-accent)'). Unset properties fall back to the widget’s default theme.

Features

Shallow-merged with defaults. Only these keys are used:

features: {
  offline: true,   // default
  retry: true,     // default
  analytics: true  // default
}

Pass only keys you want to override:

TheWebRatings.init({
  apiKey: 'your-api-key',
  features: { analytics: false }
});

Auto-Prompt

Controls the session-based auto-trigger. Enabled by default. See Auto-Prompt guide for full details.

autoPrompt: {
  enabled: true,       // default — set false to disable
  sessions: 3,         // default — sessions before first prompt
  delay: 5,            // default — seconds of page visibility before trigger
  maxDismissals: 3     // default — permanent stop after this many dismissals
}
OptionTypeDefaultDescription
enabledbooleantrueToggle auto-prompt on/off
sessionsnumber3Session threshold before first prompt
delaynumber5Seconds the page must be visible before triggering
maxDismissalsnumber3Dismissals before permanent stop

To disable:

TheWebRatings.init({
  apiKey: 'your-api-key',
  autoPrompt: { enabled: false }
});

Demo mode

When mode: 'demo' is set, you can optionally pass:

OptionTypeDescription
demoAppIdstringOptional. Key for localStorage; defaults to window.location.origin or 'twr_demo_app'.

Merge behavior

Top-level options are merged. Nested objects (colors, features) are shallow-merged at their level. Pass only keys you want to override:

TheWebRatings.init({
  apiKey: 'your-api-key',
  appName: 'My App',
  colors: { button: { background: '#111827' } }
});