Skip to content

bahaaldine/timelion-google-analytics

Repository files navigation

Build Status

Timelion Google Analytics (TGA)

alt TGA

TGA is a plugin that brings Google Analytics data to Timelion. So far it support all the metrics available as part of the Google analytics API that can be found here

However, it does not support all the dimensions available in the link above, the only used dimension is ga:date; this is just because Timelion works with data over time dimension.

Google API project configuration

Create project

Before using TGA, you need to create a Google API project on: https://console.developers.google.com

Configure access from the IAM console

Once created, because we need a server-server connection between Kibana nodejs server and Google API server, you have to create a service account key here. Note that you need to set a role that could access to Google analytics data, and also create a JSON private key

Enable Analytics reporting API

Search for the Google Reporting Analytics API here and enable it for the newly created project.

Add new email to list of Google analytics users:

In order to get data from the Google Analytic Reporting API, you need to add a user in the google analytics admin console here

Installation

TGA does not support Kibana version lower than 5.x. The TGA version you will use, should be the same than the Kibana version, you just need to adapt the following command:

#Kibana >= 5.x

./bin/kibana-plugin install  https://github.com/bahaaldine/timelion-google-analytics/releases/download/version_name/timelion-google-analytics-major.minor.patch.zip

ex:

#Kibana >= 5.x

./bin/kibana-plugin install  https://github.com/bahaaldine/timelion-google-analytics/releases/download/v5.0.0-beta1/timelion-google-analytics-5.0.0-beta1.zip

Add the your service account JSON private key to the timelion.json file located in kibana_home/src/core_plugins/timelion as follow:

...
"google": {
    "service_account": {
      "type": "service_account",
      "project_id": " ... PROJECT ID ... ",
      "private_key_id": " ... PRIVATE ID ... ",
      "private_key": " ... PRIVATE KEY ... ",
      "client_email": " ... CLIENT EMAIL ... ",
      "client_id": " ... CLIENT ID ... ",
      "auth_uri": " ... AUTH URI ... ",
      "token_uri": " ... TOKEN URI ...  ",
      "auth_provider_x509_cert_url": " ... AUTH PROVIDER X509 CERT URL ... ",
      "client_x509_cert_url": " ... CLIENT X509 CERT URL ...  "
    }
  }
...

Note that I've created a Google object that conains a service_account object which content is the actual JSON private key.

Examples

TGA provides a ganalytics Timelion Datasource object that take the following arguments:

  • viewId: Google analytics view identifier
  • metrics (optional): A list of comma separated analytics metrics to display. If not set, by default the following list of metric will be displayed users, sessions, pageviews, pageviewsPerSession, sessionDuration, bounces, percentNewSessions.
.ganalytics(viewId="88407851") // display the default list of metrics
.ganalytics(viewId="88407851", metrics="ga:users,ga:bounces") // display users traffic and bounces stats

Supported Kibana versions

This plugin is supported by:

  • Kibana 5 beta 1

Features:

  • Full-featured google analytics reporting api in Timelion
  • google analytics metrics
  • multiple anlaytics at once