https://github.com/calibr/g-analytics
Easy to use nodejs google analytics client, which uses Measurement Protocol and supports coonnection pooling
https://github.com/calibr/g-analytics
Last synced: 5 months ago
JSON representation
Easy to use nodejs google analytics client, which uses Measurement Protocol and supports coonnection pooling
- Host: GitHub
- URL: https://github.com/calibr/g-analytics
- Owner: calibr
- Created: 2015-09-18T15:35:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T10:26:34.000Z (over 6 years ago)
- Last Synced: 2025-09-27T03:56:48.067Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Install
`npm install g-analytics`
# Usage
## Create `Client` instance
```js
var Client = require("g-analytics");
var client = new Client("UA-XXXX-Y", {
poolSize: 10
});
```
## trackingId
Tracking ID for Google Analytics in format `UA-XXXX-Y`
## Options
### 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:
```js
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.