Page API for developers
Version 1
When someone records a bug on your site with the Bugcap extension, your page can attach context that a video and logs can't show: who the user is, which release they're on, and what your app thinks is happening. Bugcap exposes a small window.bugcap object on every page for this. There's nothing to install on your side.
Example
// Safe to call on every page load; it does nothing unless Bugcap is installed.
window.bugcap?.setUser({ id: "u_123", email: "[email protected]", plan: "pro" });
window.bugcap?.setContext("release", "2026.10.2");
window.bugcap?.setContext("featureFlags", { newCheckout: true });
// Shows up as a step in the report, synced to the video.
window.bugcap?.track("Checkout started", { items: 3 });
// Adds a marker on the video timeline.
window.bugcap?.mark("Payment form froze here");Methods
setUser(user): the signed-in user, as an object such as{ id, email, name }. Shown in the report's Environment tab. Passnullto clear it.setContext(key, value): any app context, such as a release, tenant or feature flags. Objects are stored as JSON. Passundefinedto remove a key. Up to 50 keys.track(name, data): records a custom step with optional data, shown in the Steps tab at the moment it happened.mark(note): adds a marked moment to the video timeline, the same as pressing Mark on the recording pill.
Timing
The API is defined before your scripts run, so you can call it straight away. Calls are kept in the page and only attached to a report if the user records one, so it's safe to call on every page load. The extension can also be installed after your page has loaded, so for code that runs once at startup you can wait for the bugcap:ready event as well:
window.addEventListener("bugcap:ready", () => {
window.bugcap.setUser({ id: currentUser.id });
});Privacy
Values are truncated to 500 characters. Keys that look sensitive, such as password, token, secret or session, are replaced with [masked], and anything that looks like a card number is masked too. Don't pass data your users wouldn't expect a bug report to contain. See the privacy policy for everything a report captures.