← Files BugfenderARCHIVED FILE

skills/bugfender-sdk-setup/references/javascript.md

1.17 KB · Nov 30, 2026 · 07:41 UTC

↓ Download file

# JavaScript Web

Use this reference after detecting a plain JavaScript web app.

## Detect

Check:

- `package.json` for a JS app
- `index.html`
- entry files such as `src/index.js`, `main.js`, or another script loaded by the page

Pick one install path and stick to it: npm or script tag.

## Minimum setup

Preferred when a bundler or `package.json` exists:

```bash
npm install @bugfender/sdk
```

Then initialize in the entrypoint:

```js
import { Bugfender } from "@bugfender/sdk";

Bugfender.init({
  appKey: "{APP_KEY}",
  baseURL: "{BASE_URL}",
  apiURL: "{SDK_API_URL}",
});
```

Only include `baseURL` and `apiURL` when custom non-default URLs are provided.

Fallback for static sites:

```html
<script defer src="https://js.bugfender.com/bugfender-v2.js"></script>
```

Then initialize in the app script.

## Integration points

- dependency file: `package.json` if present
- script-tag path: `index.html`
- bootstrap: main JS entrypoint

## Optional capabilities

- `overrideConsoleMethods`, browser event logging, and UI event logging are optional and should only be enabled if requested.

## Verification

Send one startup log:

```js
Bugfender.log("Bugfender initialized");
```

SHA-256: 2131ce441ddb0e8a907282553595c919102f4cb0e3fd31e6da4a530c5b2caf46