0.1.0 • Published 1 month ago

@bob-obringer/posthog-nextjs v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@bob-obringer/posthog-nextjs

This package is a wrapper around the PostHog analytics library for the Next.js App Router.

It simplifies posthog setup and enables event tracking.

Installation

pnpm install @bob-obringer/posthog-nextjs
npm install @bob-obringer/posthog-nextjs
yarn add @bob-obringer/posthog-nextjs

Usage

The package provides a PosthogProvider component that should be wrapped around your NextJS application (generally with other providers)

import { type ReactNode } from "react";
import { PosthogProvider } from "@bob-obringer/posthog-nextjs";
import { env } from "@/config/client";

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html>
      <body>
        <PosthogProvider token={env.posthog.apiKey} host={env.posthog.host}>
          {children}
        </PosthogProvider>
      </body>
    </html>
  );
}

TODO:

This is very crude for now. It just removes some setup boilerplate for new projects.

0.1.0

1 month ago

0.0.3

2 months ago

0.0.4

2 months ago

0.0.2

2 months ago