Complete guide to installing and configuring the CRO9 behavioral tracker
Add this script tag before the closing </body> tag on any page you want to track:
<script
src="https://cro9.com/cro9-tracker.js"
data-api-key="YOUR_API_KEY"
data-consent-mode="gdpr">
</script>| Attribute | Values | Default | Description |
|---|---|---|---|
| data-api-key | String | Required | Your unique CRO9 API key |
| data-consent-mode | gdpr, ccpa, essential, disabled | gdpr | Privacy compliance mode |
| data-debug | true, false | false | Enable console logging |
For single-page applications, use the Script component for proper loading:
import Script from 'next/script'
export default function Layout({ children }) {
return (
<html>
<body>
{children}
<Script
src="https://cro9.com/cro9-tracker.js"
data-api-key={process.env.NEXT_PUBLIC_CRO9_KEY}
data-consent-mode="gdpr"
strategy="afterInteractive"
/>
</body>
</html>
)
}Once loaded, interact with the tracker via window.CRO9:
// Track a custom event
CRO9.track('button_click', {
buttonId: 'pricing-cta',
variant: 'A',
value: 99
});// Identify a user (requires consent)
CRO9.identify('user_123', {
email: 'user@example.com',
name: 'John Doe',
plan: 'pro'
});// Listen for exit intent
window.addEventListener('cro9:exitIntent', () => {
// Show your exit popup
showExitPopup();
});See exactly what gets tracked in each consent state:
What CRO9 tracks in each consent state
Strictest compliance. No tracking until explicit consent.