Skip to content
CDGet
  • Home
  • Projects
  1. Home
  2. All projects
  3. GTag-GA

GTag-GA

LibraryUtility

A small ES module that loads Google Analytics 4 into a web page and sends page views and events through it. One import, one configuration call, and no dependencies.

Documentation (opens in a new tab)Source code (opens in a new tab)

About this project

GTag-GA adds Google Analytics 4 to a web page through the official gtag.js interface, packaged as an ES module. One import and one call with a measurement ID load gtag.js into the page, and tracking is live.

The API is the gtag API rather than a vocabulary of its own: the initialising call takes the measurement ID and an optional configuration object, and the event call takes the same arguments the official documentation shows, so anything written about gtag.js applies directly here.

The package has zero dependencies, ships TypeScript declarations and follows current Google Analytics 4 behaviour. It runs in the browser, because it adds the gtag.js script to the page itself, so in a server-rendered application the initialising call belongs in code that runs on the client. It is a few kilobytes for the one job of getting a page view or an event to Google Analytics without a tag manager in between.

Features

  • TypeScript types

  • No dependencies

Project information

Started
2023
License
MIT (opens in a new tab)
Programming languages
JavaScript
Tags
google-analyticsgtaganalyticsevent-tracking
Packages
gtag-ga (opens in a new tab)npm
Popularity
15
GitHub stars
525
npm downloads
Data points: 30. Range: 0 to 52.
GTag-GA — npm downloads, Last 30 days
npm downloads
Sep 238
Sep 30
Sep 48
Sep 56
Sep 64
Sep 70
Sep 80
Sep 920
Sep 1018
Sep 1116
Sep 122
Sep 138
Sep 1418
Sep 150
Sep 1619
Sep 1711
Sep 1821
Sep 191
Sep 2024
Sep 2111
Sep 2224
Sep 2338
Sep 2434
Sep 2552
Sep 268
Sep 270
Sep 2821
Sep 2951
Sep 3035
Oct 137
Last 30 days
ContactDonate
The projects listed here are open source under the MIT License.© 2026 CDGet. All rights reserved.