To Run:
- Clone the repository:
git clone https://github.com/dariusstrasel/Google_Analytics_Embedded_Dashboard.git
- Setup flask:
export flask_app=app.py
- Run flask:
flask run
- Visit localhost:5000 (default settings)
- AWS S3: S3 object named "google-dashboard-service-key" with a file named "key.json" File should be OAuth credentials for a service account generated from the Google API Console.
- AWS CLI
- Heroku (optional)
- Client connects to Flask web server (GET Request).
- Flask opens connection to S3 (using AWS Access Key and AWS Secret Access Key, pulled from host OS enviornment variables); reads Google Service Account JSON key to memory.
- Sends JSON key to Google Analytics Oauth Callback, which returns an authenticated oauth access token.
- Flask renders a Jinja template, embedding the access token as a Javascript constant, and serves HTML to client.
- Upon painting to client, HTML authenticates to the Google Analytics API using embedded access token.
- Upon success, template generates JavaScript components using Google Analytics Embedded Dashboard API.
- ???
- Profit!