Skip to content

futpib/next-ym

Repository files navigation

next-ym

Next.js High Order Component to integrate Yandex.Metrika on every page change.

Usage

Install it

yarn add next-ym

Import it inside your pages/_app.js;

import Router from "next/router";
import withYM from "next-ym";

Wrap your custom App container with it

// pass your YM code as first argument
export default withYM("XXXXXXXX", Router)(MyApp);

That's it, now when the user access a page it will log a pageview to Yandex.Metrika, each page change after that will also trigger a pageview on Yandex.Metrika.

Note: This module detects if it's running in localhost and do nothing there to avoid polluting your analytics with local data.

About

Next.js HOC to integrate Yandex.Metrica on every page change

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published