Pulse Documentation
Documentación de Pulse
Everything you need to deploy Pulse on Cloudflare, sign into the web UI, connect AI agents via MCP, install the 2.3 KB cookieless tracker, and query the OpenAPI 3.1 REST API.
Todo lo necesario para desplegar Pulse en Cloudflare, acceder al dashboard web, conectar agentes IA por MCP, instalar el tracker sin cookies de 2.3 KB y consultar la API REST OpenAPI 3.1.
1-Click Cloudflare DeployDespliegue en 1 clic en Cloudflare
Pulse runs on a single Cloudflare Worker with D1, Queues, KV, and R2. Cloudflare's Deploy button automatically forks the repo, provisions all required storage bindings from wrangler.jsonc, applies SQL migrations, and deploys to https://pulse.<your-subdomain>.workers.dev.
Pulse corre en un único Cloudflare Worker con D1, Queues, KV y R2. El botón de despliegue de Cloudflare crea un fork del repo, provisiona automáticamente los recursos desde wrangler.jsonc, aplica las migraciones SQL y publica en https://pulse.<tu-subdominio>.workers.dev.
Deploy to Cloudflare WorkersDesplegar en Cloudflare Workers
Prerequisites: Cloudflare Workers Paid ($5/month) is required for Cloudflare Queues (ingest buffering) and 5-minute CPU limits on backup jobs. R2 (up to 10 GB) and Cloudflare Access (up to 50 users) are free.
Requisitos: hace falta Cloudflare Workers Paid ($5/mes) para Cloudflare Queues (buffer de ingesta) y el límite de 5 min de CPU de las copias de seguridad. R2 (hasta 10 GB) y Cloudflare Access (hasta 50 usuarios) son gratuitos.
Once deployed, verify your instance is live — every deployed Worker also exposes its own live documentation portal at /docs, /docs/agents, /docs/api, and /llms.txt:
Una vez desplegado, comprueba que responde — cada Worker desplegado también sirve su propio portal de docs en vivo en /docs, /docs/agents, /docs/api y /llms.txt:
curl -fsS https://pulse.<your-subdomain>.workers.dev/healthz
# Expected: {"ok":true,"version":"0.1.0"}
Access & Dashboard LoginAcceso y login al dashboard
Pulse stores no passwords. The tracker, REST API, and MCP server work immediately with scoped API keys; the web dashboard uses free Cloudflare Access one-time email PINs guarding only /auth/access.
Pulse no almacena contraseñas. El tracker, la API REST y el servidor MCP funcionan al instante con API keys; el dashboard web usa códigos por correo de Cloudflare Access (plan gratuito) protegiendo únicamente /auth/access.
1. Mint your first API key (MCP & REST)1. Genera tu primera API key (MCP y REST)
# Writes the key safely to git-ignored .data/keys.env (never printed to stdout)
npm run admin -- key:create \
--name agent \
--scopes stats:read,sites:write,ops:write,annotations:write
2. Enable web dashboard sign-in (30s in Cloudflare Zero Trust)2. Activa el inicio de sesión web (30s en Cloudflare Zero Trust)
- Open Cloudflare Zero Trust → Settings → Authentication and ensure One-time PIN is enabled. Copy your team domain (
<team>.cloudflareaccess.com). - Go to Access → Applications → Add an application → Self-hosted. Domain: your Pulse hostname, Path:
auth/access. Add an Allow policy for your email(s). - Copy the Application Audience (AUD) Tag.
- Set
ACCESS_TEAM_DOMAINandACCESS_AUDas Worker variables (in Cloudflare Dashboard → Workers → pulse → Settings → Variables), and run:
- Abre Cloudflare Zero Trust → Settings → Authentication y asegúrate de tener activo One-time PIN. Copia tu team domain (
<team>.cloudflareaccess.com). - Ve a Access → Applications → Add an application → Self-hosted. Dominio: el host de tu Pulse, ruta:
auth/access. Añade una política Allow para tu correo. - Copia el Application Audience (AUD) Tag.
- Añade
ACCESS_TEAM_DOMAINyACCESS_AUDen las variables del Worker (Workers → pulse → Settings → Variables) y ejecuta:
# Owner emails (become owners on first sign-in)
printf '%s' "you@example.com" | npx wrangler secret put ACCESS_EMAILS
# Optional: 32-byte key to encrypt Slack/Discord/Telegram/ntfy/webhook secrets
node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('base64'))" \
| npx wrangler secret put PULSE_SECRET_KEY
Deploy & Connect with an AI AgentDesplegar y conectar con un agente IA
The repository includes docs/AGENT-SETUP.md — a complete idempotent playbook designed specifically for coding agents (Claude Code, Codex, Cursor). After a one-time npx wrangler login, the agent handles resource provisioning, deployment, MCP registration, inserting <script> tags into your websites, fixing CSP headers, verifying with install_check, and creating goals and uptime checks.
El repositorio incluye docs/AGENT-SETUP.md — un runbook idempotente escrito para agentes (Claude Code, Codex, Cursor). Tras hacer npx wrangler login una sola vez, el agente se encarga de crear recursos, desplegar, conectar el MCP, insertar el <script> en tus webs, ajustar CSP, validar con install_check y crear objetivos y monitores.
Follow docs/AGENT-SETUP.md in this repo to deploy Pulse to my Cloudflare account at pulse.yourdomain.com (EU jurisdiction), connect Pulse MCP, and install + verify tracking and an uptime check for my websites: yourdomain.com (repo at ../my-site).
Sigue docs/AGENT-SETUP.md en este repo para desplegar Pulse en mi cuenta de Cloudflare en pulse.tudominio.com (jurisdicción EU), conectar el servidor MCP de Pulse, e instalar y verificar el tracker y una comprobación de disponibilidad en mis webs: tudominio.com (repo en ../mi-web).
Custom Domain & EU JurisdictionDominio propio y jurisdicción EU
When you want a dedicated hostname (pulse.yourdomain.com), workers_dev: false, EU-pinned D1 & R2 buckets, and Cloudflare Email Routing alerts, copy .env.deploy.example to .env.deploy (git-ignored) and use npm run deploy:custom:
Si prefieres dominio propio (pulse.tudominio.com), workers_dev: false, buckets D1 y R2 en la UE y alertas por Cloudflare Email Routing, copia .env.deploy.example a .env.deploy (ignorado por git) y ejecuta npm run deploy:custom:
PULSE_DOMAIN=pulse.yourdomain.com
PULSE_D1_ID=00000000-0000-0000-0000-000000000000
PULSE_KV_ID=0123456789abcdef0123456789abcdef
PULSE_JURISDICTION=eu
# Dashboard sign-in (Cloudflare Access)
PULSE_ACCESS_TEAM_DOMAIN=your-team.cloudflareaccess.com
PULSE_ACCESS_AUD=0123456789abcdef...
npm run build
npm run deploy:custom
Tracker & EventsTracker y eventos
Drop one deferred tag into your site's <head>. Pulse automatically collects pageviews (including SPA History transitions), engaged time, scroll depth, outbound clicks, file downloads, and Core Web Vitals (LCP, INP, CLS) — in 2.3 KB gzipped.
Añade una etiqueta diferida en el <head> de tu web. Pulse recoge automáticamente páginas vistas (incluyendo navegación SPA), tiempo activo, profundidad de scroll, clics salientes, descargas y Core Web Vitals (LCP, INP, CLS) — en solo 2.3 KB gzip.
<script defer src="https://pulse.yourdomain.com/p.js" data-site="your-site-id"></script>
Script attributesAtributos del script
| AttributeAtributo | DefaultPor defecto | BehaviorComportamiento |
|---|---|---|
data-site | required | Site ID created in Pulse.ID del sitio creado en Pulse. |
data-api | script origin | Custom ingest URL if proxying /e.URL de ingesta personalizada si haces proxy de /e. |
data-exclude | none | Comma-separated path globs skipped by the tracker (e.g. "/admin/*").Globs de rutas separados por comas que el tracker ignora (ej. "/admin/*"). |
data-dev | false | Allow tracking on localhost / 127.0.0.1.Permitir envío desde localhost / 127.0.0.1. |
data-respect-dnt | false | Skip tracking when navigator.doNotTrack === "1".Omitir seguimiento si navigator.doNotTrack === "1". |
data-errors | false | Capture JS runtime errors & unhandled promise rejections.Capturar errores JS y promesas rechazadas sin capturar. |
data-vitals | true | Set "false" to disable Core Web Vitals beacons.Pon "false" para desactivar beacons de Core Web Vitals. |
data-forms | false | Automatically send form_submit for untagged forms (field values never sent).Envía form_submit automático en formularios sin etiquetar (nunca envía valores). |
Declarative & JS custom eventsEventos declarativos y por JavaScript
<!-- Zero-JS event tagging -->
<button data-pulse-event="signup" data-pulse-prop-plan="pro">Start free</button>
<!-- Programmatic queue (works before p.js finishes loading) -->
<script>
window.pulse = window.pulse || function () { (window.pulse.q = window.pulse.q || []).push(arguments); };
pulse("purchase", { revenue: 49.9, currency: "EUR" });
pulse("404");
pulse.pageview("/virtual/checkout");
</script>
Content-Security-Policy: add your Pulse origin to script-src (and script-src-elem if present) and connect-src. Ignore your own browser visits by opening your site once with #pulse-ignore.
Content-Security-Policy: añade el origen de tu Pulse a script-src (y script-src-elem si existe) y a connect-src. Para excluir tus propias visitas, abre tu web una vez con #pulse-ignore.
MCP Server (83 Scoped Tools)Servidor MCP (83 herramientas con scopes)
Pulse exposes a stateless Streamable HTTP MCP server at /mcp. Agents only see tools granted by their key's scopes. Call whoami to inspect active scopes and sites, and help { topic } for full inline documentation.
Pulse expone un servidor MCP Streamable HTTP sin estado en /mcp. Cada agente solo ve las herramientas permitidas por los scopes de su clave. Llama a whoami para inspeccionar permisos y sitios, y a help { topic } para guías en línea.
{
"mcpServers": {
"pulse": {
"url": "https://pulse.yourdomain.com/mcp",
"headers": {
"Authorization": "Bearer pulse_sk_..."
}
}
}
}
ScopesScopes y permisos
| Scope | AllowsPermite |
|---|---|
stats:read | All analytics reads, live traffic, insights, status checks, and install checks.Todas las lecturas de analítica, tiempo real, insights, estado e install_check. |
events:export | Stream raw events as CSV or NDJSON.Exportar eventos brutos en streaming (CSV o NDJSON). |
annotations:write | Create, edit, and delete chart annotations (including deploy markers).Crear, editar y borrar anotaciones en gráficas (incluyendo deploys). |
sites:write | Create, edit, and archive sites, goals, funnels, saved views, share links, and alerts.Crear, editar y archivar sitios, objetivos, embudos, vistas, enlaces compartidos y alertas. |
ops:write | Create, pause, and test uptime monitors, incidents, channels, and scheduled reports.Gestionar y probar monitores de uptime, incidentes, canales de aviso e informes programados. |
admin | Implies all scopes plus API keys (REST/UI only), users, purges, and backup settings.Implica todos los scopes más API keys (solo REST/UI), usuarios, purgados y ajustes de backup. |
REST API (108 OpenAPI 3.1 Endpoints)API REST (108 endpoints OpenAPI 3.1)
Base URL: https://pulse.yourdomain.com/api/v1 with header Authorization: Bearer pulse_sk_…. Every read endpoint is a preset over the composable POST /sites/{site}/query engine, returns an ETag, and shares a 600 req/min rate limit per key. Inspect live OpenAPI 3.1 JSON at /api/v1/openapi.json or browse /docs/api on your instance.
URL base: https://pulse.tudominio.com/api/v1 con cabecera Authorization: Bearer pulse_sk_…. Todos los endpoints de lectura son presets sobre POST /sites/{site}/query, devuelven ETag y comparten límite de 600 req/min por clave. El esquema OpenAPI 3.1 vivo está en /api/v1/openapi.json y renderizado en /docs/api.
curl -X POST "https://pulse.yourdomain.com/api/v1/sites/my-site/query" \
-H "Authorization: Bearer $PULSE_KEY" \
-H "Content-Type: application/json" \
-d '{
"metrics": ["visitors", "pageviews", "bounce_rate", "revenue"],
"dimensions": ["channel", "country"],
"filters": [["contains", "page", ["/pricing"]]],
"date_range": "28d",
"compare": "previous_period"
}'
| Method | Endpoint | PurposeUso |
|---|---|---|
| GET | /api/v1/ | Key self-discovery: scopes, sites, and unlocked capabilitiesAutodescubrimiento: scopes, sitios y capacidades activas |
| GET | /api/v1/sites/{site}/overview | Full dashboard payload in one D1 round tripTodo el dashboard de un sitio en una sola consulta D1 |
| POST | /api/v1/sites/{site}/query | Arbitrary metrics × dimensions × filters (?format=csv supported)Consulta libre métricas × dimensiones × filtros (admite ?format=csv) |
| POST | /api/v1/sites | Register a website and receive its ready-to-paste snippetRegistrar una web y recibir su snippet listo para pegar |
| GET | /api/v1/sites/{site}/install-check | Live HTML, CSP, and hit-drop installation diagnosticsDiagnóstico real de etiqueta, CSP y descartes de ingesta |
| POST | /api/v1/hooks/deploy | Idempotent CI webhook to add deploy annotations on chartsWebhook idempotente de CI para anotar deploys en gráficas |
| GET | /api/v1/ops/status | All uptime monitors, 90-day daily bars, incidents, and backupsMonitores de uptime, barras de 90 días, incidentes y backups |
Uptime Checks, Alerts & ReportsUptime, alertas e informes programados
- 7 Monitor kinds:
http(status + keyword),json(path assertions & freshness),heartbeat(secret ping URL/hb/:tokenfor cron jobs),d1_query(read-only SQL health check),pulse_ingest(adaptive silence detection),dns, anddomain_expiry. - Traffic alert rules:
above,below,change_pct(vs same window last week),no_data,event, andnew_error. - Notification channels: Cloudflare Email Routing, Slack, Discord, Telegram, ntfy, and HMAC-signed webhooks (secrets encrypted with
PULSE_SECRET_KEY). - Scheduled reports: weekly or monthly email/chat digests across chosen sites with live HTML preview inside the dashboard.
- 7 tipos de monitor:
http(estado y palabra clave),json(aserciones por ruta y frescura),heartbeat(URL secreta/hb/:tokenpara crons),d1_query(SELECT de solo lectura),pulse_ingest(silencio adaptativo),dnsydomain_expiry. - Reglas de alerta de tráfico:
above,below,change_pct(vs misma franja la semana anterior),no_data,eventynew_error. - Canales de notificación: Cloudflare Email Routing, Slack, Discord, Telegram, ntfy y webhooks firmados por HMAC (secretos cifrados con
PULSE_SECRET_KEY). - Informes programados: resúmenes semanales o mensuales por correo o chat con vista previa HTML en el dashboard.
Privacy & Data ModelPrivacidad y modelo de datos
- Daily visitor hashing:
visitor_id = HMAC(daily_salt, site | IP | user_agent). Salts rotate per site's local day and are deleted within 48 h; raw IP addresses are never written to D1, queues, or logs. - Sessions & bounces: hits separated by < 30 minutes form one session; a single pageview with < 10s engaged time counts as a bounce.
- Retention & backups: raw events remain for each site's retention window (default 25 months) before compacting into daily rollups. Weekly gzipped backups stream to your own R2 bucket.
- Hash diario de visitante:
visitor_id = HMAC(sal_diaria, sitio | IP | user_agent). Las sales rotan según el día local de cada sitio y se borran en ≤ 48 h; la IP nunca se guarda en D1, colas ni logs. - Sesiones y rebotes: impactos separados por < 30 min forman una sesión; una sola vista con < 10 s activos cuenta como rebote.
- Retención y backups: los eventos brutos se conservan durante la retención del sitio (25 meses por defecto) antes de compactarse en rollups diarios. Copias semanales comprimidas en tu propio bucket R2.
Local Development & TestingDesarrollo local y tests
Pulse runs locally in Node 22+ (including Windows, without needing workerd) using node:sqlite behind a D1 shim:
Pulse corre en local en Node 22+ (incluido Windows, sin depender de workerd) usando node:sqlite tras un shim de D1:
npm ci
npm run build
npm run dev:seed # 3 demo sites + 120 days of traffic + annotations + monitors
npm run dev # API on :8787 + Vite HMR dashboard on :5173
# Open http://localhost:8787/__dev/login
# Full verification suite
npm run typecheck && npm run lint && npm test && npm run tracker:size && npm run build