Skip to content

ES module for the Google Analytics Global site tag

License

Notifications You must be signed in to change notification settings

mamadOuologuem/ga-gtag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Global site tag (gtag.js) - Google Analytics

npm npm bundle size (minified)

ES module for the Google Analytics Global Site Tag.

Install

$ npm install --save ga-gtag

Usage

Pick your favorite:

const { gtag, install } = require("ga-gtag");
import gtag, { install } from 'ga-gtag';

... then:

install('UA-#########-#');    // Substitute your tracking ID

install() adds the Global Site Tag script element into <head>. It only needs to be called once, but can safely be called multiple times (the script won't be re-added).

From there gtag() can be used as specified in Google's doc:

gtag('event', 'login', { 'method': 'Google' });

About

ES module for the Google Analytics Global site tag

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%