haideralipunjabi / next-goatcounter

GoatCounter plugin for Next.js projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

next-goatcounter

next-goatcounter is a plugin that makes integrating GoatCounter Analytics into you NextJS project easy.
Pull Requests are very welcome.

Feel like supporting this free plugin?

Buy Me A Coffee

Setup

First, install it:

npm install next-goatcounter

or

yarn add next-goatcounter

Now, in app/layout.js

import { GCScript } from "next-goatcounter";

and in return

    <body>
    <GCScript siteUrl={"https://site.goatcounter.com/count"} />
    {
        children
    }
    </body>

Note: GCScript supports scriptSrc parameter to specify self hosted count.js location

Usage

To send custom events to GoatCounter,

first

import { GCEvent } from "next-goatcounter";

then use GCEvent like this

GCEvent(path, title);

About

GoatCounter plugin for Next.js projects

License:MIT License


Languages

Language:TypeScript 100.0%