Basic Setup
Configure and customize Triagly to match your application's needs.
Basic Configuration
import Triagly from '@triagly/sdk';const triagly = new Triagly({apiKey: 'pub_live_abc123',// Optional: UI customizationtheme: 'auto', // 'light' | 'dark' | 'auto'position: 'bottom-right', // Button positionbuttonShape: 'rounded', // 'rounded' | 'circular' | 'square' | 'pill' | 'expandable'buttonText: 'Feedback',});
Configuration Options
apiKey*requiredYour Triagly API key from Settings > API Keys
themeLight, dark, or auto theme detection (default: auto)
positionWidget button position (default: bottom-right)
Callbacks & Events
const triagly = new Triagly({apiKey: 'pub_live_abc123',onSuccess: (feedbackId) => {console.log('Feedback submitted:', feedbackId);showToast('Thank you for your feedback!');},onError: (error) => {console.error('Feedback error:', error);showToast('Failed to submit. Please try again.');},onOpen: () => {console.log('Widget opened');trackEvent('feedback_widget_opened');},onClose: () => console.log('Widget closed'),onCancel: () => console.log('Cancel clicked'),onDismiss: () => console.log('X clicked'),});
Available Callbacks
onSuccess(feedbackId)Called after successful submission
onError(error)Called when submission fails
onOpen()Called when widget opens
onClose()Called when widget closes (any method)
Custom Metadata
const triagly = new Triagly({apiKey: 'pub_live_abc123',metadata: {appVersion: '1.2.3',environment: 'production',userId: getCurrentUserId(),userPlan: 'premium',},});
Use Cases for Metadata
- Track which app version feedback came from
- Include user plan or permission level
- Add environment information (staging, production)
- Include feature flags or A/B test variants
Console Log Capture
const triagly = new Triagly({apiKey: 'pub_live_abc123',captureConsole: true, // Enable console capture (default: true)consoleLogLimit: 50, // Keep last 50 logsconsoleLogLevels: ['error', 'warn'], // Capture errors and warnings});
Console Capture Features
- Captures errors and warnings automatically
- Includes stack traces for errors
- Auto-sanitizes sensitive data (passwords, tokens, emails)
- Minimal performance impact