Quick Start
Get up and running with GoodLogs in under 2 minutes. No infrastructure to set up — just install the SDK and start tracking.
1. Install the SDK
npm install @aj-2000-test/goodlogs-sdk
2. Initialize
import { GoodLogs } from "@aj-2000-test/goodlogs-sdk"
const gl = new GoodLogs({
apiKey: "gl_pk_your_key_here",
// Opt into the unified APM pipeline (errors, traces, web vitals).
useEnvelope: true,
})
Get your API key from Dashboard → Settings → API Keys.
With useEnvelope: true the browser SDK automatically:
- wraps every
fetch()call as a span (op:http.client) and injects a W3Ctraceparentheader, - collects Core Web Vitals (LCP / INP / CLS / FCP / TTFB) via
PerformanceObserver, - captures
window.onerror, unhandled rejections, and console errors as Issues.
3. Track Events
gl.track("signup", { plan: "pro", source: "landing_page" })
4. Send Logs
gl.error("Payment failed", {
orderId: "ord_123",
error: "card_declined",
service: "billing",
})
5. Capture Exceptions
try {
await chargeCard()
} catch (e) {
gl.captureException(e, { tags: { feature: "checkout" } })
}
Errors are fingerprinted and grouped into Issues in the dashboard. Duplicates bump the event count instead of creating new issues. If you resolve an issue and the same error appears on a later release, it's automatically flipped to regressed.
6. Trace a slow flow
const tx = gl.startTransaction({ name: "/checkout", op: "ui.action" })
const span = tx.startChild({ op: "http.client", description: "POST /pay" })
await fetch("/api/pay", { method: "POST" })
span.finish()
tx.finish()
Open Dashboard → Performance for endpoint latency (p50/p95/p99) and slow traces. Click a trace to see the waterfall.
7. View in Dashboard
| Page | What you'll see |
|---|---|
| Issues | Grouped exceptions with stack traces, breadcrumbs, and trace links |
| Performance | Endpoints sorted by p95, Core Web Vitals tiles, recent slow traces |
Trace (/dashboard/traces/<id>) | Span waterfall with attributes and events |
| Web Vitals | LCP / INP / CLS rating distributions, slowest pages per metric |
| Session Replay | DOM recordings of user sessions with linked console/network/errors |
| Profiling | CPU flamegraph, top functions by self-time, profile chunk list |
| Explorer | Ad-hoc GQL across logs, events, errors, spans, web_vitals |
| AI Debug | Plain-English questions answered with GQL |
Tip: The SDK auto-batches and flushes every 5 seconds. On page close, it uses navigator.sendBeacon to ensure no data is lost.
Zero-config path: Even without
captureException/startTransactioncalls in your code, GoodLogs background workers automatically:
- synthesise Issues from any log at
severity:errororseverity:fatal,- synthesise traces from logs that share a
request_id/correlation_idproperty — useful when migrating from plain logging.