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

@bradgarropy/next-google-analytics

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bradgarropy/next-google-analytics

📊 google analytics for next.js

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
192
decreased by-54.93%
Maintainers
1
Weekly downloads
 
Created
Source

📊 next google analytics

version downloads size github actions coverage typescript contributing contributors discord

Google Analytics 4 for Next.js.

📦 Installation

This package is hosted on npm.

npm install @bradgarropy/next-google-analytics

🥑 Usage

This component integrates Google Analytics 4 into your Next.js website. It downloads and initializes the gtag script, and no further setup is required. In order to work, this component must be placed in the pages/_app.js file.

// pages/_app.js
import GoogleAnalytics from "@bradgarropy/next-google-analytics"

const App = ({Component, pageProps}) => {
    return (
        <>
            <GoogleAnalytics measurementId="G-XXXXXXXXXX" />
            <Component {...pageProps} />
        </>
    )
}

To ensure that Google Analytics is working, you can check a few things.

  1. A network request was made to https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX.
  2. window.dataLayer exists and includes your Measurement ID.
  3. When you navigate your site, items are added to the window.dataLayer array.

📖 API Reference

<GoogleAnalytics>

NameRequiredDefaultExampleDescription
measurementIdtrue"G-XXXXXXXXXX"Google Analytics Measurement ID.

The example below shows how to use the component.

<GoogleAnalytics measurementId="G-XXXXXXXXXX" />

❔ Questions

🐛 report bugs by filing issues
📢 provide feedback with issues or on twitter
🙋🏼‍♂️ use my ama or twitter to ask any other questions

✨ contributors


Brad Garropy

💻 📖 ⚠️ 🚇

Keywords

FAQs

Package last updated on 15 Feb 2022

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