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 integration for Next.js.
Run the following command to install in your project:
npm install @panelbear/panelbear-nextjs
Or with yarn:
yarn add @panelbear/panelbear-nextjs
You can now import, and use the Panelbear hook on your project.
// ./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;
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.
// ./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;
- Fix breaking change to function export level
- Support new Next.js 13 'app' directory and client-only components.
- Add peer dependency support for NextJS 13.
- Add peer dependency support for React 18.
- Update peer dependencies
- Upgrade deps
- Update docs
- Initial open source release.
If you discover any issue regarding security, please disclose the information responsibly by following the instructions here. Do NOT create a Issue on the GitHub repo.
For community alternatives to this package, you can check out:
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.
See LICENSE.