Skip to main content

Proactive

ProactiveClient from @cstar.help/js/proactive watches for frustration signals — rage clicks, exit intent, idle timeout, console errors, repeated form failures — and fires events. You decide what nudge to render.

Setup

setup.js
import { ProactiveClient } from '@cstar.help/js/proactive';

const proactive = new ProactiveClient({
  teamSlug: 'acme'
});

proactive.start(); // Begin signal detection

Listen for triggers

listen.js
const off = proactive.on('trigger', (event) => {
  // event.signalType — 'rage_click' | 'exit_intent' | 'idle_timeout' | ...
  // event.message    — Configured message from the team's dashboard
  showNudge(event.message);
});

// Tear down on unmount
off();
proactive.stop();

Report what happened

After you show your nudge, tell the client whether the user took the bait. The data feeds the team's analytics so they can tune triggers over time.

report.js
function showNudge(message) {
  showBanner(message, {
    onAccept: () => {
      proactive.engage('rage_click');  // User opened chat
      openChat();
    },
    onDismiss: () => {
      proactive.dismiss('rage_click'); // User closed the nudge
    }
  });
}

Signals it watches

  • Rage clicks: 3+ clicks in the same area within 2 seconds.
  • Exit intent: mouse moves toward the browser chrome at speed.
  • Idle timeout: no input for the configured duration.
  • Console errors: 3+ uncaught errors in 15 seconds.
  • Form abandonment: filled 2+ fields, then bounced.

Which signals are active and the messages they show are configured in your team's dashboard under Settings → Proactive.

Next up