# @datadog/browser-logs

Latest version **7.13.0** (published 2026-09-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @datadog/browser-logs
pnpm add @datadog/browser-logs
yarn add @datadog/browser-logs
bun add @datadog/browser-logs
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 7.13.0 |
| Published | 2026-09-14 |
| First published | 2019-12-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 399 |
| Maintainers | datadog |

## Links

- npm: https://www.npmjs.com/package/@datadog/browser-logs
- Repository: https://github.com/DataDog/browser-sdk
- npm.io page: https://npm.io/package/@datadog/browser-logs

## Recent versions

- 7.13.0 (latest) — 2026-09-14
- 7.12.0 — 2026-09-03
- 7.11.0 — 2026-09-02
- 7.10.0 — 2026-08-28
- 7.9.0 — 2026-08-18
- 7.8.0 — 2026-08-06
- 7.7.0 — 2026-07-30
- 7.6.1 — 2026-07-24
- 7.6.0 — 2026-07-20
- 7.5.0 — 2026-07-06
- 7.4.0 — 2026-06-23
- 7.3.0 — 2026-06-15
- 7.2.0 — 2026-05-28
- 7.1.0 — 2026-05-11
- 7.0.0 — 2026-04-30
- … 318 more at https://npm.io/package/@datadog/browser-logs/versions

## README

# Browser Log Collection

Send logs to Datadog from web browser pages with the browser logs SDK.

See the [dedicated datadog documentation][1] for more details.

## Usage

After adding [`@datadog/browser-logs`][2] to your `package.json` file, initialize it with:

```javascript
import { datadogLogs } from '@datadog/browser-logs'

datadogLogs.init({
  clientToken: '<DATADOG_CLIENT_TOKEN>',
  site: '<DATADOG_SITE>',
  forwardErrorsToLogs: true,
  sessionSampleRate: 100,
})
```

After the Datadog browser logs SDK is initialized, send custom log entries directly to Datadog:

```javascript
import { datadogLogs } from '@datadog/browser-logs'

datadogLogs.logger.info('Button clicked', { name: 'buttonName', id: 123 })

try {
  ...
  throw new Error('Wrong behavior')
  ...
} catch (ex) {
  datadogLogs.logger.error('Error occurred', { team: 'myTeam' }, ex)
}
```

<!-- Note: all URLs should be absolute -->

[1]: https://docs.datadoghq.com/logs/log_collection/javascript
[2]: https://www.npmjs.com/package/@datadog/browser-logs

---
_Source: https://npm.io/package/@datadog/browser-logs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
