Exports metrics from Google Analytics and writes them to InfluxDB
Last updated 4 years ago by nichdiekuh .
Apache-2.0 · Original npm · Tarball · package.json
$ cnpm install analytics2influx 
SYNC missed versions from official npm registry.


Exports metrics from Google Analytics + Realtime Reporting API and writes the data to InfluxDB >= 0.9.x


This project was inspired by from Peter Hedenskog. If you want to send your analytics data to Graphite, have a look at Gatographite!


npm install analytics2influx

Google-API Authentication

To export data from Google Analytics you first have to create an Analytics developer API account and add the account to the related Analytics profiles. These instructions should hopefullx get you through


You can fetch metrics from the Google Analytics API:

and metrics from the Google Realtime Reporting API:

Please note, that you cannot combine metrics from both APIs.


You can either call analytics2inlux with commandline parameters or use the file to configure everything.

Analytics API

analytics2influx --metrics ga:pageviews,ga:sessions --dimensions ga:hostname --influxHost localhost --influxUser tester --influxPassword test  

Realtime Reporting API

analytics2influx --mode rt --rt_metrics ga:activeUsers --rt_dimensions rt:userType --influxHost localhost --influxUser tester --influxPassword test  


// Fetch data from yesterday and send to Graphite
// Fetch data from three days back -> today and send to Graphite
analytics2influx 3
// Send data for a specific date
analytics2influx 2015-06-01

Things you should probably know

For Google Analytics metrics the date & time dimensions are added automatically. Metric from the Google Realtime API use the current system timestamp. Doublecheck your systems date and time settings before using the Realtime Reporting API.

All dimensions and their values are used as tags in InfluxDB. The Analytics ViewId is added as "ga_id" automatically for both APIs.

It doesn't matter how many metrics you select while querying the APIs, all values are stored in separate measurements named ga_[metricname] or rt_[metricname] with the tags mentioned above.

Current Tags

  • 0.0.1                                ...           latest (4 years ago)

1 Versions

  • 0.0.1                                ...           4 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © |