# @panelbear/panelbear-nextjs

> Official Panelbear integration for Next.js

Latest version **2.0.1** (published 2023-01-23) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @panelbear/panelbear-nextjs
pnpm add @panelbear/panelbear-nextjs
yarn add @panelbear/panelbear-nextjs
bun add @panelbear/panelbear-nextjs
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2023-01-23 |
| First published | 2021-09-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Anthony N. Simon |
| Maintainers | anthonynsimon |
| Keywords | panelbear, analytics, next, nextjs, monitoring, metrics |

## Links

- npm: https://www.npmjs.com/package/@panelbear/panelbear-nextjs
- Repository: https://github.com/panelbearhq/panelbear-nextjs
- Homepage: https://github.com/panelbearhq/panelbear-nextjs#readme
- Issues: https://github.com/panelbearhq/panelbear-nextjs/issues
- npm.io page: https://npm.io/package/@panelbear/panelbear-nextjs

## Dependencies (2)

- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [@panelbear/panelbear-js](https://npm.io/package/@panelbear/panelbear-js.md) ^1.3.3

## Recent versions

- 2.0.1 (latest) — 2023-01-23
- 2.0.0 — 2023-01-23
- 1.0.5 — 2022-10-26
- 1.0.4 — 2022-08-05
- 1.0.3 — 2021-12-08
- 1.0.2 — 2021-12-08
- 1.0.1 — 2021-09-10
- 1.0.0 — 2021-09-10

## README

# Panelbear Next.js integration

> **Important:** As of version 2.0.1 of this package only Next.js 13 or later will be supported. For previous versions of Next.js please install version 1.0.5 of this package.

Official [Panelbear](https://panelbear.com) integration for Next.js.

## Quickstart

### Install

Run the following command to install in your project:

```
npm install @panelbear/panelbear-nextjs
```

Or with yarn:

```
yarn add @panelbear/panelbear-nextjs
```

### Basic usage

You can now import, and use the Panelbear hook on your project.

```javascript
// ./pages/_app.js

import { usePanelbear } from '@panelbear/panelbear-nextjs';

function CustomApp({ Component, pageProps }) {
  // Load Panelbear only once during the app lifecycle
  usePanelbear('YOUR_SITE_ID');

  return <Component {...pageProps} />;
}

export default CustomApp;
```

### Debug-mode

When developing in localhost, Panelbear does not send events to avoid using your quota.

You can enable debug mode to send events when testing things locally. It will also log messages to console.

```javascript
// ./pages/_app.js

import { usePanelbear } from '@panelbear/panelbear-nextjs';

function CustomApp({ Component, pageProps }) {
  
  usePanelbear('YOUR_SITE_ID', {
    debug: true
  });

  return <Component {...pageProps} />;
}

export default CustomApp;
```


## Changelog

### 2.0.1

- Fix breaking change to function export level

### 2.0.0

- Support new Next.js 13 'app' directory and client-only components.

### 1.0.5

- Add peer dependency support for NextJS 13.

### 1.0.4

- Add peer dependency support for React 18.

### 1.0.3

- Update peer dependencies

### 1.0.2

- Upgrade deps

### 1.0.1

- Update docs

### 1.0.0

- Initial open source release.

## Security Disclosure

If you discover any issue regarding security, please disclose the information responsibly by following the instructions [here](https://panelbear.com/security/). Do NOT create a Issue on the GitHub repo.

## Contributors

[@anthonynsimon](https://github.com/anthonynsimon)
[@EndBug](https://github.com/EndBug)

## Alternatives

For community alternatives to this package, you can check out:

- [next-use-panelbear](https://github.com/alizahid/next-use-panelbear)

## Contributing

Please check for any existing issues before openning a new Issue. If you'd like to work on something, please open a new Issue describing what you'd like to do before submitting a Pull Request.

## License

See [LICENSE](https://github.com/panelbearhq/panelbear-nextjs/blob/master/LICENSE).

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