LaneshotDocs

Search the docs

Find a page or a section

Open Laneshot

Capture bugs

App metadata

Add the signed-in user, the release, feature flags, and other context from your own web app to every capture taken on it.

App metadata is context your web app adds to captures: who was signed in, which release was running, which feature flags were on. The extension reads it when someone captures a bug on your site, and it appears in the trace viewer, the Markdown report, the MCP tools, and the API.

It answers the questions a capture can't answer on its own. When Maya Chen records "Card payment fails with 3-D Secure on Safari" on the Acme Storefront, the capture already shows the page, the browser, and the failing request. App metadata adds that the customer was cus_8842 on the Plus plan, on release storefront@2026.11.2, with the new-checkout flag on.

Add metadata to your app

Install the SDK in your web app:

npm install @laneshot/sdk

Then set the user when someone signs in, and register the rest once at startup:

import { setMetadata, setUser } from "@laneshot/sdk/browser";

// After sign-in. Pass null on sign-out.
setUser({ id: customer.id, email: customer.email, plan: customer.plan });

// Called each time someone captures a bug, so values are always current.
setMetadata(() => ({
  release: import.meta.env.VITE_RELEASE,
  flags: featureFlags.enabled(),
  cartItems: cart.items.length,
  locale: i18n.language,
}));
Function Description
setUser(user | null) Who is signed in. Stored under the user key.
setMetadata(provider) A function returning an object, sync or async, or a plain object for values that never change. Returns a function that removes it. You can register several: their keys are merged in order, and user is added last.
clear() Removes the user and every provider, for example on sign-out.

@laneshot/sdk/browser is a single small module with no dependencies, and it makes no network requests. Nothing happens until someone with the Laneshot extension captures a bug on your site. See SDK for the full reference.

Without the SDK

The extension reads a single global, so you can also set it yourself, for example from a tag manager:

<script>
  window.__laneshot = {
    version: 1,
    getMetadata: () => ({
      user: { id: window.dataLayer?.userId },
      release: document.querySelector('meta[name="release"]')?.content,
    }),
  };
</script>

getMetadata can return an object or a promise of one.

When it's read

The extension asks your page for its metadata at the moment a capture starts:

Capture Read when
Video recording Recording starts.
Screenshot The screenshot is taken.
Instant replay The replay is saved.

It's read from the top-level page only. Metadata set inside iframes is ignored.

The extension waits 500 ms for the answer. If your function is slower, throws, or isn't there, the capture goes ahead without metadata. A failing provider registered with setMetadata is skipped, and the others are still read.

Recording links don't include app metadata: the person records from Laneshot's own page, not from your app.

What's kept

Metadata comes from page code, so Laneshot treats it as untrusted and cleans it twice: in the page before it reaches the extension, and again in the extension.

Redacted keys

Values whose key looks like a credential are replaced with [redacted], at any depth. Keys are matched case-insensitively, anywhere in the name:

Pattern Examples of redacted keys
pass, password, passwd, passphrase password, userPassword, passcode
secret clientSecret
token accessToken, csrf_token
api-key, api_key, apikey stripeApiKey
authorization authorization
credit-card, credit_card, creditcard creditCardLast4
card-number, card_number, cardnumber cardNumber
cvv, cvc cvc
ssn ssn

These are the same rules Laneshot applies to request headers, query strings, and bodies. See What is captured.

Values

Value Kept as
Strings As is, up to 1,000 characters. Longer strings are cut and end with ….
Numbers, booleans, null As is. NaN and Infinity become strings.
BigInt A string.
Arrays The first 100 items. Items that can't be kept become null.
Objects The first 100 keys. Objects nested more than four levels below the top are left out.
Functions, symbols, undefined Left out.
Date, Map, Set, class instances Their own enumerable properties only, which is usually an empty object. Convert dates to ISO strings, such as new Date().toISOString().

The 10 KB cap

The cleaned metadata must fit in 10,000 bytes of JSON. When it doesn't, Laneshot keeps top-level keys in the order you set them, as long as they fit, and adds "_truncated": true. Put the most useful keys first, and keep large objects, such as a whole Redux store, out.

If nothing is left after cleaning, the capture has no app metadata.

Where it appears

In the trace viewer

Open the capture and select the Info tab. App metadata lists each top-level key, labeled Set by the app, above the browser and device details. Strings are shown as is, and other values as JSON.

The Info tab with app metadata
The Info tab of a capture, with the app metadata the storefront set above the browser and device details.

See The trace viewer.

In the Markdown report

The report used by Ask Claude, the MCP tool read_trace, laneshot trace --markdown, and the API includes a section after the environment:

## App metadata

Set by the application itself, such as the signed-in user or feature flags.

```json
{
  "release": "storefront@2026.11.2",
  "flags": ["new-checkout", "3ds-v2"],
  "cartItems": 2,
  "locale": "en-US",
  "user": {
    "id": "cus_8842",
    "email": "jordan.lee@example.com",
    "plan": "plus"
  }
}
```

In the API and MCP

environment.appMetadata in the REST API, in the SDK's traces.get, and in the MCP tool get_trace.

Privacy

  • Metadata never leaves the browser until someone captures a bug, and only goes to your own Laneshot server.
  • It's visible to everyone who can open the capture, including people with its public link. Leave out anything you wouldn't put in a bug report, such as addresses or payment details.
  • Prefer stable internal IDs over names and emails when your support tools can look people up by ID.

Recipes

Support agents at Acme use their own admin panel to look customers up. Add a direct link, so whoever reads the capture can open the customer's account:

import { setUser, setMetadata } from "@laneshot/sdk/browser";

setUser({ id: customer.id, plan: customer.plan });
setMetadata(() => ({
  supportUrl: `https://admin.acme.test/customers/${customer.id}`,
  openTicket: supportWidget.currentTicketId() ?? null,
}));

Record the release and flags

Most "works for me" bugs come from a different release or a flag. With React and a flags client:

import { setMetadata } from "@laneshot/sdk/browser";
import { useEffect } from "react";

export function LaneshotContext({ flags }: { flags: Record<string, boolean> }) {
  useEffect(
    () =>
      setMetadata(() => ({
        release: process.env.NEXT_PUBLIC_RELEASE,
        flags: Object.keys(flags).filter((name) => flags[name]),
      })),
    [flags],
  );
  return null;
}

setMetadata returns its own cleanup function, so the provider is replaced when the flags change.

Only in some environments

The functions do nothing harmful when the extension isn't installed, so you can ship them to production. To limit them to staging, set them conditionally:

if (location.hostname.startsWith("staging.")) {
  setMetadata({ environment: "staging", seed: window.__TEST_SEED__ });
}

Troubleshooting

The Info tab has no App metadata section. Check the following:

  • The capture was taken with the extension. Recording links don't read app metadata.
  • The page ran setUser or setMetadata before the capture started. Run await window.__laneshot?.getMetadata() in the browser console to see what the extension would read.
  • Your function answers within 500 ms.
  • The metadata was set in the top-level page, not inside an iframe.

A value shows [redacted]. Its key matched a redacted pattern. Rename the key.

The metadata ends with "_truncated": true. It was over 10 KB. Remove large values, or move the most useful keys first.

Dates show as {}. Convert them to strings with toISOString().