Lightweight JavaScript tracking script that monitors AI bot traffic on websites using whiterank.io
npm install whiterankjsThis package provides a lightweight JavaScript tracking script that monitors AI bot traffic on websites. It detects when AI bots (ChatGPT, Claude, Perplexity, etc.) visit a website and sends analytics data to WhiteRank's API.
``bash`
npm install whiterankjs
`html`
`html`
Add the configuration before loading the tracking script:
`html`
#### Using NPM
`javascript`
import 'whiterankjs/dist/track.esm.js';
#### Using CDN (unpkg)
`html`
#### Complete HTML Example
`html`
1. Sign up at whiterank.io
2. Go to AI Bot Analytics
3. Add your website
4. Copy the Site ID provided
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| siteId | string | Yes | Unique identifier for your site (format: wr-xxxxx) |domain
| | string | Yes | Your website domain (e.g., example.com) |
- ✅ AI Bot Detection: Automatically detects 20+ AI bots (GPTBot, ClaudeBot, PerplexityBot, etc.)
- ✅ Automatic Tracking: Tracks page loads, time on page, and user activity
- ✅ Reliable Data Sending: Uses navigator.sendBeacon() for reliable transmission
- ✅ Privacy-Friendly: No cookies, no personal data collected
`jsx
import Script from 'next/script';
export default function App({ Component, pageProps }) {
return (
<>
src="https://unpkg.com/whiterankjs@latest/dist/track.umd.js"
strategy="afterInteractive"
/>
>
);
}
`
Add to your main index.html:
`html`
1. Go to Appearance → Theme Editor
2. Edit header.php or use a plugin like "Insert Headers and Footers"
3. Add the configuration and script in the
For complete documentation, platform-specific guides, troubleshooting, and API reference, visit:
📚 Full Documentation at whiterank.io
- Website: whiterank.io
- Documentation: whiterank.io/docs
- Support: support@whiterank.io
Copyright © 2024 WhiteRank. All rights reserved.