Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.
/ realtime Public archive

Realtime visitors dashboard for multiple Google Analytics profiles.

Notifications You must be signed in to change notification settings

janpapenbrock/realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

realtime

Setup

Clone this repo

git clone https://github.com/janpapenbrock/realtime.git

Install dependencies

/path/to/realtime $ npm install

Create Google API client key file

  1. Create a project in Google Developers Console
  2. At APIs, enable Analytics API
  3. Create an OAuth client ID, Service Account type
  4. Note the mail address associated with it somewhere
  5. Download the created file named YOURPROJECTNAME-<hash>.p12
  6. Convert this file into key-pem with
openssl pkcs12 -in YOURPROJECTNAME-<hash>.p12 -out key.pem -nocerts -nodes -passin pass:notasecret
  1. Put key.pem into realtime/config/

Allow API project to access Analytics properties

  1. Open Google Analytics
  2. Navigate to Admin and choose your account on the left
  3. Open User Management
  4. At Add permissions for:, enter the mail address associated to your API client ID (<long-string>@developer.gserviceaccount.com). Read and Analyze setting is sufficent.

Configure Google Analytics views to be shown in realtime dashboard

  1. Copy realtime/config/google.json.sample to realtime/config/google.json
  2. Open realtime/config/google.json in your favorite editor
  3. Set the mail address once again:
"email": "<long-string>@developer.gserviceaccount.com",
  1. Analytics accounts are structured on three levels: Accounts, Properties and Views.
  2. Realtime allows to add all Accounts which should be considered for the dashboard
    "account": {
        "include": [ "1234567", "2345678" ]
    },
  1. To avoid multiple views of the same website show up, filtering on both Property and View level is possible:
    "webProperty": {
        "exclude": [ "UA-123456789-1" ]
    },
    "profile": {
        "exclude": [ "9876543210" ]
    }

Start up

When you are all set up, in a terminal, run

/path/to/realtime $ node index.js

Then open up Chrome and visit http://localhost:8888

Profit

The result of all this hard work should be something like this:

About

Realtime visitors dashboard for multiple Google Analytics profiles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published