• Stars
    star
    188
  • Rank 201,304 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Google Analytics data exporting library for NodeJS

Google Analytics

UNMAINTAINED: In case it wasn't clear from the lack of activity, I don't have the time to work on this project anymore.
I'd be happy to transfer ownership to someone else or add someone as a contributor to the project. Please reach out to me
and let me know!


This project doesn't work and hasn't worked for some time due to google removing the use based configuration.
	See more at https://github.com/ncb000gt/node-googleanalytics/issues/36#issuecomment-383822453

Pull data from Google Analytics for use in projects.

The library maintains tracking of the token so that you don't have to and will push the token around with your requests. Should you require a different token, just create a new GA instance. However, this is asynchronous through eventing so if you do want the token you can latch onto the event.

  • Updated for NodeJS 0.6.x *

Usage

With a user and password:

var GA = require('googleanalytics'),
    util = require('util'),
    config = {
        "user": "myusername",
        "password": "mypassword"
    },
    ga = new GA.GA(config);

ga.login(function(err, token) {
    var options = {
        'ids': 'ga:<profileid>',
        'start-date': '2010-09-01',
        'end-date': '2010-09-30',
        'dimensions': 'ga:pagePath',
        'metrics': 'ga:pageviews',
        'sort': '-ga:pagePath'
    };

    ga.get(options, function(err, entries) {
       util.debug(JSON.stringify(entries));
    });
});

If you have already gotten permission from a user, you can simply use the oAuth access token you have:

var GA = require('googleanalytics'),
    util = require('util'),
    config = {
        "token": "XXXXXXXXXXXX"
    },
    ga = new GA.GA(config);

var options = {
    'ids': 'ga:<profileid>',
    'start-date': '2010-09-01',
    'end-date': '2010-09-30',
    'dimensions': 'ga:pagePath',
    'metrics': 'ga:pageviews',
    'sort': '-ga:pagePath'
};

ga.get(options, function(err, entries) {
    util.debug(JSON.stringify(entries));
});

You can specify the type of token by setting 'tokenType', default is 'Bearer'.

See node-gapitoken for easy service account Server to Server authorization flow.

API

  • login([callback]) - The callback is optional. However, if it is given, it is added to the token event.
  • get(options, callback)

Event API

  • token(err, token)
  • entries(err, entries)

Entry API

  • metrics[]
  • dimensions[]

Each array contains objects. These objects contain the following:

  • name - The name of the metric or dimension requested
  • value - The value associated. If the value is a Number, it is parsed for you. Otherwise, it will be a string.

Contributors

License

see license file

More Repositories

1

node-es

NodeJS module for ElasticSearch.
JavaScript
103
star
2

node-shoutcast

Shoutcast server built on NodeJS.
JavaScript
43
star
3

merlin

C++ Bindings to GraphicsMagick for NodeJS.
C++
29
star
4

node-bbcode

A bbcode parser for nodejs.
JavaScript
21
star
5

blinds

A web based client for Riak using NodeJS.
JavaScript
9
star
6

node3p

AmazonMP3 downloader using NodeJS
JavaScript
7
star
7

pinned

Incredibly basic bookmarking application.
JavaScript
7
star
8

node-gs

NodeJS lib that wraps cli execution of gs (ghsotscript).
JavaScript
6
star
9

ximple-forms

Module for Axiom CMS that allows the creation of input forms on the fly.
JavaScript
4
star
10

xearch

A search module for Axiom CMS. Allows the placement of search from anywhere on your site.
JavaScript
4
star
11

node-portscan

Port scanner in node.
JavaScript
4
star
12

ndfs

Node Distributed File System
JavaScript
3
star
13

dynamicfiles

DynamicFiles module for Axiom Stack projects. Works well for things like crossdomain.xml or themes.
JavaScript
3
star
14

node-queuestream

Queue up streams in nodejs.
JavaScript
3
star
15

ruckus

What the repo name says
JavaScript
3
star
16

axiom-soap

A javascript SOAP library. Currently written using Rhino.
JavaScript
3
star
17

jslideview

Sliding view of hierarchical data.
JavaScript
3
star
18

node-ventstatus

Ventrilo server status module for Node.js
JavaScript
3
star
19

node3p-web

A web interface to downloading music from AmazonMP3 with Node3p.
JavaScript
3
star
20

use-cases

Repository aimed at helping you find and understand use-cases.
2
star
21

axiom-github

A module for Axiom Stack that provides API access to Github.
JavaScript
2
star
22

axiom-jira

A module for Axiom Stack that allows access to Jira.
JavaScript
2
star
23

oh-bot

This is not an "Oh Face".
JavaScript
2
star
24

erlade

Jade for the Erlang.
Erlang
2
star
25

ax-bot

An IRC bot build on Axiom Stack using the PircBot API
JavaScript
2
star
26

js-hashing

A JS tool to hash strings.
JavaScript
2
star
27

base64

Base64 Java Library
Java
2
star
28

roster

A module for Axiom Stack that provides all you need for basic user and rights management.
JavaScript
2
star
29

managesessions

This is a project that allows an Axiom CMS administrator to manage sessions.
JavaScript
2
star
30

kb

A knowledge base application/module for Axiom Stack.
JavaScript
2
star
31

axiom-http

A module for Axiom Stack that provides common HTTP APIs.
JavaScript
2
star
32

wallcandy

JavaScript
2
star
33

axiom-gravatar

A Gravatar module for Axiom Stack.
JavaScript
2
star
34

path

This is the python path library created by Jason Orendorff. It makes directory traversal easier.
Python
2
star
35

pandemonium

A Public Beta interface and management tools for Axiom Stack.
JavaScript
2
star
36

beaker

Scala based web server
Scala
1
star
37

clh

A tool to help build your changelog.
JavaScript
1
star
38

choqok-bitly

bit.ly url shortening plugin for choqok
C++
1
star
39

dt-utils

Java utilities that I've collected/created over time.
Java
1
star
40

scripts

Scripts that help me manage the day-to-day.
Shell
1
star
41

randomeats

A tool to pick where you and your friends go to lunch.
Ruby
1
star
42

ncb000gt.github.com

1
star
43

docker-flutter-test

Dockerfile
1
star
44

dot-files

My configurations and their friends.
Emacs Lisp
1
star
45

nehe_tutorials

NeHe Tutorials That I've converted
Java
1
star
46

ga-exporter

A Google Analytics Exporter application.
JavaScript
1
star
47

python-magic

This is a clone of the debian copy of python-magic.
C
1
star