HUB
Sign inSign up

travix/analytics-to-graphite

By travix

•Updated almost 11 years ago

This docker container collects google analytics data and ships it to graphite (carbon)

Image
0

1.3K

travix/analytics-to-graphite repository overview

⁠Google Analytics to Graphite

Fetch Google Analytics metrics, and send them to a given Graphite host.

⁠Setup Google Analytics authorizations

Make sure to enable the Analytics API via the GCloud interface. Download your GCloud service account .p12 file and generate a .pem file:

openssl pkcs12 -in google-service-account.p12 -nocerts -passin pass:YOUR_PASSWORD -nodes -out google-service-account.pem

In Google Analytics, add a new user with read permission using the service account email address.

⁠Run the container
# Retreive data from yesterday
docker run -t -i \
  -e "[email protected]" \
  -e "GA_MAX_RESULTS=1000" \
  -e "GA_METRICS=ga:pageviews,ga:sessions,ga:avgTimeOnSite" \
  -e "GA_MINUTES=false" \
  -e "GA_PEM_PATH=/home/root/google-service-account.pem" \
  -e "GA_VIEW_ID=123456" \
  -e "GRAPHITE_HOST=localhost" \
  -e "GRAPHITE_NAMESPACE=google-analytics" \
  -e "GRAPHITE_PORT=2003" \
  -v "$(pwd)/google-service-account.pem":/home/root/google-service-account.pem \
  analytics

# Retreive data from specific date
docker run -t -i \
  -e "[email protected]" \
  -e "GA_MAX_RESULTS=1000" \
  -e "GA_METRICS=ga:pageviews,ga:sessions,ga:avgTimeOnSite" \
  -e "GA_MINUTES=false" \
  -e "GA_PEM_PATH=/home/root/google-service-account.pem" \
  -e "GA_VIEW_ID=123456" \
  -e "GRAPHITE_HOST=localhost" \
  -e "GRAPHITE_NAMESPACE=google-analytics" \
  -e "GRAPHITE_PORT=2003" \
  -v "$(pwd)/google-service-account.pem":/home/root/google-service-account.pem \
  analytics \
  gatographite 2015-12-25
Tag summary
Recent tags
Content type
Image
Digest
Size
249.9 MB
Last updated
almost 11 years ago
docker pull travix/analytics-to-graphite:latest