next-goatcounter
v1.0.5
Published
GoatCounter plugin for Next.js projects
Downloads
94
Maintainers
Readme
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?
Setup
First, install it:
npm install next-goatcounter
or
yarn add next-goatcounter
Now, in _app.js
import { GCScript } from "next-goatcounter";
and in return
<GCScript siteUrl={"https://site.goatcounter.com/count"} />
<Component {...pageProps} />
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);