Skip to content

Debug Mode

The Campaign Cart SDK includes a comprehensive debug overlay system that helps developers inspect state, monitor events, and troubleshoot issues during development.

Add the ?debugger=true parameter to any page URL:

https://yoursite.com/checkout?debugger=true
  1. Automatic activation - Debug overlay loads and displays at the bottom of the page
  2. Global access - Creates the window.nextDebug object for console access
  3. Verbose logging - Sets logger to DEBUG level for detailed console output

The debug overlay provides multiple panels for inspecting different aspects of the SDK:

  • View current cart state and items
  • Inspect cart totals, discounts, and calculations
  • Monitor cart updates in real-time
  • Test cart operations directly
  • View current SDK configuration
  • Inspect API keys and endpoints
  • Check feature flags and settings
  • Monitor configuration changes
  • View campaign data and settings
  • Inspect product/package information
  • Monitor campaign-specific state
  • Test campaign operations
  • Monitor checkout form state
  • Inspect validation errors
  • View payment method selections
  • Debug checkout flow issues
  • Real-time event monitoring
  • Visual timeline of SDK events
  • Event details and payloads
  • Performance timing information
  • Inspect localStorage data
  • View sessionStorage contents
  • Monitor storage changes
  • Clear storage for testing

When debug mode is active (via ?debugger=true), a global nextDebug object is available in the console:

// Access debug overlay controls
nextDebug.overlay.show()
nextDebug.overlay.hide()
nextDebug.overlay.toggle()
nextDebug.overlay.isVisible()

When the debug overlay is visible:

  • ESC - Toggle overlay visibility
  • Tab - Switch between panels
  • ↑/↓ - Navigate within panels
  • Add/remove test items
  • Apply test discounts
  • Clear cart
  • Simulate cart errors
  • Filter events by type
  • Export event log
  • Clear timeline
  • Pause/resume monitoring
  • Search storage keys
  • Edit values directly
  • Export/import storage
  • Clear specific keys

The debugger includes an X-Ray mode that highlights SDK-enhanced elements with color-coded outlines:

  • Cyan (#4ecdc4): Display attributes (data-next-display)
  • Yellow (#ffe66d): Conditional visibility (data-next-show)
  • Red (#ff6b6b): Checkout elements
  • Green (#a8e6cf): Package selectors
  • Purple (#6c5ce7): Bump/toggle elements
  • Orange (#ffa502): Selected states
  • Pink (#ff8b94): Package IDs

Toggle X-Ray mode from the debug overlay toolbar.

  • Track render times
  • Monitor API call durations
  • Identify performance bottlenecks
  • View memory usage
// Add items to cart
nextDebug.addToCart(packageId, quantity)
// Remove items from cart
nextDebug.removeFromCart(packageId)
// Update quantity
nextDebug.updateQuantity(packageId, quantity)
// Add test items (packages 2, 7, 9)
nextDebug.addTestItems()
// Reload campaign data
nextDebug.loadCampaign()
// Clear campaign cache
nextDebug.clearCampaignCache()
// Get cache information
nextDebug.getCacheInfo()
// Inspect specific package details
nextDebug.inspectPackage(packageId)
// Test shipping methods
nextDebug.testShippingMethod(methodId)
// Get analytics status
await nextDebug.analytics.getStatus()
// View active providers
await nextDebug.analytics.getProviders()
// Track custom event
await nextDebug.analytics.track('custom_event', { data: 'value' })
// Enable analytics debug mode
await nextDebug.analytics.setDebugMode(true)
// Invalidate analytics context
await nextDebug.analytics.invalidateContext()
// Debug attribution data
nextDebug.attribution.debug()
// Get attribution for API
nextDebug.attribution.get()
// Set funnel name
nextDebug.attribution.setFunnel('FUNNEL_NAME')
// Set Everflow click ID
nextDebug.attribution.setEvclid('click_id')
// Get current funnel
nextDebug.attribution.getFunnel()
// Clear persisted funnel
nextDebug.attribution.clearFunnel()
// View upsell journey
nextDebug.order.getJourney()
// Check if order is expired
nextDebug.order.isExpired()
// Clear order cache
nextDebug.order.clearCache()
// Get order statistics
nextDebug.order.getStats()
// Open accordion
nextDebug.accordion.open('accordion-id')
// Close accordion
nextDebug.accordion.close('accordion-id')
// Toggle accordion
nextDebug.accordion.toggle('accordion-id')
// Log custom events to the timeline
window.dispatchEvent(new CustomEvent('debug:log', {
detail: {
type: 'custom',
message: 'My debug message',
data: { /* any data */ }
}
}));
// Update debug content
window.dispatchEvent(new CustomEvent('debug:update-content'));
  • Save current state for later comparison
  • Export state as JSON
  • Import saved states for testing
  • Compare state differences
  • View API requests and responses
  • Inspect request headers
  • Monitor request timing
  • Simulate network errors
https://yoursite.com?debugger=true

The primary and recommended method.

  1. Development Only - Never enable debug mode in production environments
  2. Performance Impact - Debug mode adds overhead; disable when testing performance
  3. Privacy Concerns - Debug overlay may display sensitive data (API keys, customer info)
  4. Storage Management - Clear debug storage regularly to avoid conflicts
  1. Ensure ?debugger=true is in the URL
  2. Check browser console for errors
  3. Verify SDK is properly loaded
  4. Try hard refresh (Ctrl+F5 or Cmd+Shift+R)

If the debug overlay is causing performance problems:

  • Disable event timeline if too many events
  • Clear storage panel data
  • Reduce update frequency in settings
  • Use panel-specific views instead of “All”

This happens when debug mode is not enabled. Solutions:

https://yoursite.com?debugger=true

Add the parameter and reload.

// Refresh specific panel
nextDebug.overlay.updateContent()
// Reinitialize debug overlay
nextDebug.reinitialize()

The debug overlay displays:

  • API keys and configuration
  • Cart and order details
  • Customer information
  • Analytics data
  • Internal SDK state

Best practices:

  • Be cautious when sharing debug screenshots
  • Clear sensitive data from storage panel
  • Disable debug mode for production builds
  • Use environment-specific configuration

The debug overlay complements browser dev tools:

  • Console logs include debug context
  • Network tab shows SDK requests
  • Elements panel highlights SDK attributes
  • Performance profiler includes SDK marks