New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

next-ga

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-ga

Next.js High Order Component to integrate Google Analytics on every page change.

  • 2.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
345
decreased by-23.5%
Maintainers
1
Weekly downloads
 
Created
Source

next-ga

Next.js High Order Component to integrate Google Analytics on every page change.

Usage

Install it

yarn add next-ga

Import it inside your pages/_app.js;

import Router from "next/router";
import withGA from "next-ga";

Wrap your custom App container with it

// pass your GA code as first argument
export default withGA("UA-xxxxxxxxx-1", Router)(MyApp);

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

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

Keywords

FAQs

Package last updated on 08 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc