An open API service indexing awesome lists of open source software.

https://github.com/ordinary-dev/next-shynet

A library for integrating Shynet (self-hosted privacy-friendly web analytics) into your next.js project.
https://github.com/ordinary-dev/next-shynet

analytics monitoring nextjs shynet typescript web-analytics

Last synced: about 1 year ago
JSON representation

A library for integrating Shynet (self-hosted privacy-friendly web analytics) into your next.js project.

Awesome Lists containing this project

README

          

# Next-Shynet

A library for integrating [shynet](https://github.com/milesmcc/shynet)
into your [next.js](https://nextjs.org/) project.

It helps to easily use shynet in a single page application.
The library also has declarations for typescript.

## Usage

Install this library:

```bash
npm install next-shynet
```

### App router

Change your `app/layout.tsx`:

```jsx
import { ShynetForAppRouter } from "next-shynet"

export default async function RootLayout({children}) {
return (





)
}
```

### Pages router

Change your `_app.js`:

```jsx
import Shynet from "next-shynet"

const YourApp = ({ Component, pageProps }) => (





)
```

The link to the tracking pixel is optional.

By default, the script is not loaded during development.
To force the script to be included, add the `ignoreEnv` option:
```jsx

```

## How to build

```bash
npm install
npm run build
```

The generated files will be in the `/dist` directory.

## Authors

- Ivan Reshetnikov