Configuration Guide
Customize Proofit to match your brand, design requirements, and analytics setup for an optimal user experience.
Basic Configuration
Getting Started
Configure Proofit by passing options to the init()
method.
window.Proofit.init({ apiKey: 'YOUR_API_KEY', // Required: Your Proofit API key theme: 'light', // Optional: 'light' or 'dark' position: 'bottom-left', // Optional: Notification position delay: 3, // Optional: Delay between notifications (seconds) // Additional configuration options... });
API Key
Your API key is required for initialization and is available in your Proofit dashboard. Never expose your API key in client-side code in production environments.
Global Settings
Control the overall behavior of Proofit with these global settings:
Option | Type | Default | Description |
---|---|---|---|
apiKey | String | Your unique API key from Proofit dashboard | Yes |
debug | Boolean | false | Enables console logging for debugging |
disabled | Boolean | Completely disables all Proofit functionality | No |
autoStart | Boolean | true | Automatically start displaying messages |
domain | String | auto-detected | Override the domain for cross-domain tracking |
cookieDuration | Number | 30 | Cookie duration in days |
Runtime Methods
Control Proofit during runtime with these methods:
Enable/Disable Proofit
// Disable all Proofit notifications Proofit.disable(); // Re-enable Proofit notifications Proofit.enable(); // Check if Proofit is currently enabled const isEnabled = Proofit.isEnabled();
Manual Initialization
// Initialize with autoStart: false Proofit.init({ apiKey: 'YOUR_API_KEY', autoStart: false }); // Start Proofit manually later Proofit.start(); // Stop all Proofit activity Proofit.stop();
Event Handling
// Listen for notification display Proofit.on('notification:show', function(data) { console.log('Notification shown:', data); }); // Listen for notification clicks Proofit.on('notification:click', function(data) { console.log('Notification clicked:', data); }); // Listen for errors Proofit.on('error', function(error) { console.error('Proofit error:', error); });
Best Practices
- Security: Use environment variables or server-side configuration to inject your API key rather than hardcoding it.
- Performance: Use the asynchronous loading method for better page performance.
- Testing: Enable debug mode during development and testing, but disable it in production.