<commit_before># Push Google Analytics data to Graphite

Fetch your Google Analytics data and send it to Graphite, massive love to  https://github.com/etsy/GoogleAnalyticsToGraphite for inspiration.

This is a work in progress and when it is finished, I'll wrap the functionality on a Docker container.

## Setup your Google Account and setup everything
To fetch the metrics from Google Analtics, we use the Google API v3. To get it up and running, it needs a couple of things. I'll add the steps asap but if you follow these http://www.bentedder.com/server-to-server-authorization-for-google-analytics-api-with-node-js/ instructions for now, it will hopefully work :)

## Configuration
You can either feed the script with params (check cli.js, I'll add docs later) or add your values to the export.sh file and source it, then all values are fetched from the environment variables.

## Choosing which data to fetch
Metrics that you can fetch is the one in the Google Analytics API:
https://developers.google.com/analytics/devguides/reporting/core/dimsmets

## Install
npm install -g gatographite

## Run

// Fetch data from yesterday and send to Graphite
gatographite

// Fetch data from three days back and send to Graphite
gatographite 3

// Send data for a specific date
gatographite 2015-06-01
<commit_msg>examples<commit_after># Push Google Analytics data to Graphite

Fetch your Google Analytics data and send it to Graphite, massive love to  https://github.com/etsy/GoogleAnalyticsToGraphite for inspiration.

This is a work in progress and when it is finished, I'll wrap the functionality on a Docker container.

## Setup your Google Account and setup everything
To fetch the metrics from Google Analtics, we use the Google API v3. To get it up and running, it needs a couple of things. I'll add the steps asap but if you follow these http://www.bentedder.com/server-to-server-authorization-for-google-analytics-api-with-node-js/ instructions for now, it will hopefully work :)

## Configuration
You can either feed the script with params (check cli.js, I'll add docs later) or add your values to the export.sh file and source it, then all values are fetched from the environment variables.

## Choosing which data to fetch
Metrics that you can fetch is the one in the Google Analytics API:
https://developers.google.com/analytics/devguides/reporting/core/dimsmets

## Install
```
npm install -g gatographite
```

## Run

```
// Fetch data from yesterday and send to Graphite
gatographite
```

```
// Fetch data from three days back -> today and send to Graphite
gatographite 3
```

```
// Send data for a specific date
gatographite 2015-06-01
```

{'fraction_non_alphanumeric': 0.06852409638554217, 'fraction_numerical': 0.007530120481927711, 'mean_word_length': 4.25098814229249, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706273', 'n_tokens_mistral': 762, 'n_tokens_neox': 716, 'n_words': 363}