This is a simple command line app that will make a call to the google analytics realtime api to get current number of active users.
-
Create a service account in the google developer console. (https://console.developers.google.com/)
-
Generate a key (preferably in '.p12' format)
-
Go to the Google Analytics console and add the newly created service account (With Read and Analyse Permissions) on the 'Admin -> User Management' page.
-
Copy the key to the same directory as the python files.
-
In main.py set the following fields.
- account_email = 'yourserviceaccount@developer.gserviceaccount.com'
- keyfile = 'KEYNAME.p12'
- analytics_view_id = 'ga:VIEW_ID'