Socket
Socket
Sign inDemoInstall

g-analytics

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g-analytics

Ease to use nodejs google analytics client, which uses Measurement Protocol


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Install

npm install g-analytics

Usage

Create Client instance

var Client = require("g-analytics");
var client = new Client({
  trackingId: "UA-XXXX-Y",
  poolSize: 10
});

Options

trackingId

Tracking ID for Google Analytics in format UA-XXXX-Y

poolSize

For high load applications it's a good idea to reuse connections to Google Analytics server instead of creation a new one for each Hit/Event/etc.., so this option set maximium parallel connections to analytics servers.

Send info to google analytics

This lib doesn't have methods for different analytics stats types, so it has only one method send, which does all work to send data to analytics server:

client.send({
  "t": "pageview",
  "cid": 123456,
  "dh": "host.com",
  "dp": "/"
});

More Google Analytics parameters you can see here: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cs.

Keywords

FAQs

Package last updated on 18 Sep 2015

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