ga-report
v1.0.0
Published
Unofficial NodeJS wrapper for the Google Analytics Core Reporting API
Downloads
2
Readme
Google Analtyics Reporting
NodeJS wrapper for Google Analytics Core Reporting API
API
Instanciate
Report = require('ga-report');
var report = new Report('[email protected]', 'mypassword');
var report.once('ready', function() {
// ready to report
});
Get Accounts
report.getAccounts(function(err, accounts) {
console.error(err);
for (var i = 0; i < accounts.length; i++) {
console.log(accounts[i]);
}
});
Get Webproperties
report.getWebproperties(accountId, function(err, webproperties) {
console.error(err);
for (var i = 0; i < webproperties.length; i++) {
console.oog(webproperties[i]);
}
});
Get Webproperties
report.getWebproperties(accountId, webpropertyId, function(err, profile) {
console.error(err);
for (var i = 0; i < profiles.length; i++) {
console.oog(profiles[i]);
}
});
Get Report
var options = {
'ids': 'ga:123456-UA',
'start-date': '2013-10-01',
'end-date': '2013-10-31',
'metrics': 'ga:visits,ga:bounces'
};
report.get(options, functon(err, data) {
if (err) console.error(err);
console.dir(data);
)};