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
| Option | Type | Description |
|---|---|---|
apiKey | string | Required. Your TheWebRatings API key. |
mode | 'production' | 'demo' | Optional. Default 'production'. Use 'demo' for docs/playgrounds; no backend calls, data in localStorage. |
debug | boolean | Optional. Enable debug logging. Default false. |
appName | string | Optional. Override app name (defaults to API response). |
platform | 'auto' | 'web' | ... | Optional. Default 'auto' (detected). |
colors | object | Optional. See Colors below. |
features | object | Optional. See Features below. |
autoPrompt | object | Optional. 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
}| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Toggle auto-prompt on/off |
sessions | number | 3 | Session threshold before first prompt |
delay | number | 5 | Seconds the page must be visible before triggering |
maxDismissals | number | 3 | Dismissals 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:
| Option | Type | Description |
|---|---|---|
demoAppId | string | Optional. 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' } }
});