@agentstats/sdk 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/bots.cjs +1022 -0
- package/dist/bots.d.cts +265 -0
- package/dist/bots.d.ts +265 -0
- package/dist/bots.js +1010 -0
- package/dist/browser.iife.js +1 -1
- package/dist/index.cjs +182 -16
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +182 -16
- package/dist/lite.iife.js +1 -1
- package/dist/server.cjs +293 -204
- package/dist/server.d.cts +76 -18
- package/dist/server.d.ts +76 -18
- package/dist/server.js +293 -204
- package/package.json +21 -12
package/README.md
CHANGED
|
@@ -44,6 +44,16 @@ No WebMCP tools? `lite.js` (~1.7 KB) records visitors only, and `AgentStats.trac
|
|
|
44
44
|
| `custom` | anything you send with `AgentStats.track('checkout_completed', { value: 42 })` |
|
|
45
45
|
| pageviews (Visitors) | each page a person views, including client-side navigation; `track()` events count as goals. Sent to `/api/ingest/web` without cookies; the server keeps no IP or user agent |
|
|
46
46
|
|
|
47
|
+
## The bot catalogue
|
|
48
|
+
|
|
49
|
+
`@agentstats/sdk/bots` is the catalogue behind `detectBot()`, for code that classifies user agents itself, such as a log pipeline: `BOT_PATTERNS` (the hand-checked `CURATED` list, then the generic `CATCH_ALL` patterns), `BOT_PRODUCTS`, `firstMatch(patterns, userAgent)`, `classifyUserAgent()`, `classifyReferral()` and the AI categories.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { BOT_PATTERNS, firstMatch } from '@agentstats/sdk/bots'
|
|
53
|
+
|
|
54
|
+
firstMatch(BOT_PATTERNS, userAgent) // { product: 'chatgpt', category: 'training', … } or null
|
|
55
|
+
```
|
|
56
|
+
|
|
47
57
|
## Options
|
|
48
58
|
|
|
49
59
|
```ts
|