Documentation
Minimal docs. Fast start.
Everything you need to get b8t running and extracting value from your bot traffic data.
Quickstart
Install b8t
Add this single line to your HTML before </head>:
<script type="module" src="https://bot.b8t.io/static/index.js"></script>
Verify installation
After installing, you can access detection results via the global window.botDetectionResult object:
// Check detection result
console.log(window.botDetectionResult);
// Example output:
// {
// isBot: false,
// confidence: 0.95,
// signals: ['behavioral', 'execution'],
// timestamp: '2025-01-15T10:30:00Z'
// }
SDK result object
The b8t SDK exposes detection results through the window.botDetectionResult object:
interface BotDetectionResult {
// Whether traffic was classified as bot
isBot: boolean;
// Confidence score (0-1)
confidence: number;
// Array of signals that triggered detection
signals: string[];
// Timestamp of detection
timestamp: string;
// Optional: session ID
sessionId?: string;
// Optional: detection category
category?: 'scraping' | 'credential_stuffing' | 'ddos' | 'other';
}
Signal types
- behavioral — Mouse/keyboard patterns
- execution — JS hook detection
- environment — Browser APIs
- network — Request patterns
GA4 integration
Send events to Google Analytics 4
b8t can automatically push bot detection events to GA4. Add this after the install snippet:
<script>
window.b8tConfig = {
ga4Id: 'G-XXXXXXXXXX',
trackEvents: ['bot_detected', 'bot_verified', 'human_passed']
};
</script>
<script type="module" src="https://bot.b8t.io/static/index.js"></script>
Custom event tracking
Listen for bot detection events in your own code:
window.addEventListener('b8t:detection', (event) => {
const { isBot, confidence, signals } = event.detail;
// Send to your analytics
gtag('event', 'b8t_detection', {
'event_category': 'bot_detection',
'is_bot': isBot,
'confidence': confidence,
'signals': signals.join(',')
});
});
Recommended GA4 events
| Event | Description |
|---|---|
| bot_detected | Initial bot detection |
| bot_verified | Bot confirmed after verification |
| human_passed | Human visitor passed through |
| bot_diverted | Bot traffic diverted to monetization |
Looker Studio dashboard
Use the b8t dashboard template
We've created a pre-built Looker Studio dashboard to visualize your bot traffic data:
- 1 Export b8t data to BigQuery (see below)
- 2 Open Looker Studio
- 3 Create a new report from BigQuery data source
- 4 Use our template dimensions and metrics
IVT refund reports
Generate invalid traffic reports
b8t can help you generate IVT reports for ad platform refund claims. Export data includes:
- Session-level detection data
- Timestamp and duration
- Detection category
- Confidence scores
- IP ranges (for GIVT classification)
Reports can be generated in CSV or JSON format compatible with Google, Meta, and other major ad platforms.
BigQuery export
Export to BigQuery
For larger sites, export b8t data to BigQuery for custom analysis:
// Configure BigQuery export
window.b8tConfig = {
bigQuery: {
projectId: 'your-project',
datasetId: 'b8t_data',
tableName: 'detections'
}
};
Schema
detections table schema:
- timestamp: TIMESTAMP
- session_id: STRING
- is_bot: BOOLEAN
- confidence: FLOAT
- signals: STRING (repeated)
- category: STRING
- ip_hash: STRING
- user_agent: STRING
- page_path: STRING
Developer FAQ
Does b8t work with CSP?
Yes. Add bot.b8t.io to your script-src directive.
Can I disable auto-tracking?
Yes. Set window.b8tConfig = { autoTrack: false } and use custom event listeners.
What's the SDK file size?
~15KB gzipped. It loads asynchronously and doesn't block page render.
Does b8t work with AMP?
AMP support is on our roadmap. Contact us for early access.
Can I filter by URL path?
Yes. Use window.b8tConfig.paths = ['/api/*', '/admin/*'] to target specific routes.