Skip to content

arunk-s/javascript-api-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Analytics JavaScript API Utilities

This repository is a place to find utility modules for interacting with the Google Analytics APIs. The source files are available as node-style modules (in the /lib folder) and as standalone browser scripts (in the build folder). The browser versions are built with browserify and can be accessed from the global object window.gaApiUtils or by using an AMD module loader.

Installation

# Install via npm
npm install git+https://git@github.com/googleanalytics/javascript-api-utils.git

# Install via bower
npm install googleanalytics/javascript-api-utils

Usage Examples:

Note: all the examples below assume the user is authenticated and gapi.client is loaded on the page. They also assume the browser supports promises. If you're including this library on sites where modern browser usage isn't guaranteed, a Promise polyfill is required.

Account Summaries

var accountSummaries = require('javascript-api-utils/lib/account-summaries');

// Log a list of all the user's Google Analytics views to the console.
accountSummaries.get().then(function(summaries) {
  console.log(summaries.allViews());
});

Metadata

var metadata = require('javascript-api-utils/lib/metadata');

// Log a list of all the user's Google Analytics views to the console.
metadata.get().then(function(columns) {
  console.log(columns.allMetrics());
});

To see a demo of these modules in action, run the demo file on a local server on port 8080.

Contributing

If you'd like to contribute modules to this repository please follow the Google JavaScript style guide and make sure to include relevant tests with any pull requests. Also include demos where appropriate.

Running the tests

make test

Building the browser versions

make build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 95.5%
  • HTML 3.6%
  • Makefile 0.9%