Docs/Integrations

Server-side tracking integrations

BobBuilds tracks AI-referred visits with a one-line track.js snippet. AI bot crawlers do not run JavaScript — use one of the integrations below to forward server or CDN logs. Get your bbst_ site ID from the Developer page.

One-command installs

Most non-technical teams should start with the basic script install from the Developer page. Use the commands below when someone on the website or engineering side can run one command in the site codebase.

# Next.js on Vercel (App Router)
npx @bobbuilds/init install-tracking --platform vercel-next --key bb_your_api_key

# Static/Cloudflare sites
npx @bobbuilds/init install-tracking --platform cloudflare-worker --key bb_your_api_key --html public/index.html

# nginx + HTML shell
npx @bobbuilds/init install-tracking --platform nginx --key bb_your_api_key --html public/index.html

What this command does: adds the visitor tracking snippet, turns on server-side bot collection, and connects the site to the correct BobBuilds workspace.

Cloudflare Worker

Deploy a Worker on your Cloudflare zone. It forwards every request to BobBuilds with CF metadata (IP, ASN, country, cache status) without blocking the client response.

cd integrations/cloudflare-worker
cp wrangler.toml.example wrangler.toml
npx wrangler secret put BOBBUILDS_SITE_TOKEN # bbst_... from Developer page
npx wrangler secret put BOBBUILDS_API_URL # https://your-bobbuilds-host.com
# Edit wrangler.toml → add your domain route
npx wrangler deploy

Source: integrations/cloudflare-worker/worker.js

WordPress plugin

  1. Copy integrations/wordpress/bobbuilds-tracker/ to wp-content/plugins/bobbuilds-tracker/
  2. Activate BobBuilds AI Tracker in WordPress admin
  3. Settings → BobBuilds Tracker → paste your bbst_ site ID

Installs track.js automatically and optionally logs bot user-agents on each request.

nginx log shipper

export BOBBUILDS_SITE_TOKEN=bbst_your_id
export BOBBUILDS_API_URL=https://your-bobbuilds-host.com

# Ship a log file
npx @bobbuilds/log-shipper --file /var/log/nginx/access.log

# Or tail live
tail -F /var/log/nginx/access.log | npx @bobbuilds/log-shipper

Recommended JSON log format

log_format bobbuilds_json escape=json
 '{"ts":"$time_iso8601","path":"$uri","ua":"$http_user_agent",'
 '"ip":"$remote_addr","status":$status,"latency_ms":$request_time}';
access_log /var/log/nginx/bb_access.log bobbuilds_json;

Cloudflare Logpush

Logpush can post request logs straight into BobBuilds now. Use a site token in the destination URL.

curl -X POST "https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/logpush/jobs" \
 -H "Authorization: Bearer {CF_TOKEN}" \
 -H "Content-Type: application/json" \
 -d '{
 "name": "bobbuilds-bot-radar",
 "destination_conf": "https://app.bobbuilds.ai/api/v1/ingest/logpush?siteToken=bbst_your_site_id",
 "dataset": "http_requests",
 "logpull_options": "fields=ClientRequestURI,ClientRequestHost,ClientRequestMethod,ClientRequestUserAgent,ClientIP,ClientCountry,ClientASN,ClientRequestReferer,CacheStatus,WAFAction,EdgeResponseStatus,EdgeTimeToFirstByteMs&timestamps=rfc3339",
 "enabled": true
 }'

What gets sent

  • Page path, HTTP status, user-agent, source IP
  • Reverse-DNS and ASN (resolved server-side if not provided)
  • Referrer host for AI referral attribution
  • No cookies, form fields, passwords, or PII

Endpoint: POST /api/v1/ingest/bot-events · Referral pixel: POST /api/v1/referral

Daily robots.txt monitor

Self-hosted BobBuilds registers a daily pg_cron job automatically on server boot (6:00 UTC) when INTERNAL_CRON_SECRET and API_BASE_URL are set. You can also trigger manually:

curl -X POST "$API_BASE/api/trpc/internal.runRobotsMonitor?batch=1" \
 -H "Authorization: Bearer $INTERNAL_CRON_SECRET" \
 -H "Content-Type: application/json" \
 -d '{"0":{"json":null}}'

Or open Robots Policy in the dashboard — it auto-refreshes snapshots older than 24 hours.