Overview:
The Next-Plausible npm version is an easy-to-use integration for adding Plausible analytics to Next.js websites. By exposing the Plausible context in the application, users can monitor their site’s performance and gain valuable insights. The integration simplifies the process and ensures smooth analytics implementation for Next.js projects.
Features:
- Simple Integration: Easily add Plausible analytics to Next.js websites.
- Customization Options: Configure various settings such as domain, custom domain, and tracking options.
- Flexible Usage: Implement analytics at the top level of the application or on specific pages.
- Outbound Link Tracking: Enable tracking for outbound link clicks.
- File Download Tracking: Track downloads of files on the website.
- Custom Event Tracking: Enable tracking for custom events in HTML elements.
- Localhost Tracking: Option to enable tracking for localhost.
- Hash-based Routing Support: Enable hash-based routing for analytics.
Installation:
To install the Next-Plausible npm version, follow these steps:
- Make sure you are using next.js version 11.1.0 or higher.
- Install next-plausible using npm:
npm install next-plausible
- Expose the Plausible context in your Next.js app by adding the following code to your _app.js file:
import { PlausibleProvider } from 'next-plausible';
function MyApp({ Component, pageProps }) {
return (
<PlausibleProvider customDomain="https://plausible.io" domain="yourdomain.com">
<Component {...pageProps} />
</PlausibleProvider>
);
}
export default MyApp;
- Customize the PlausibleProvider props as needed based on the provided options.
Summary:
The Next-Plausible npm version offers a seamless way to integrate Plausible analytics into Next.js websites. With features like customizations, flexible usage options, and various tracking capabilities, users can easily set up analytics tracking for their projects. By following the installation guide and configuring the PlausibleProvider props, website owners can effectively monitor their site’s performance and user interactions.