Automated Google Analytics Connector For PythonAutomated Google Analytics Connector For Python
Instantly integrate the fully automated google analytics data feeder in your python application.Automated Google Analytics Connector For Python
Instantly integrate the fully automated google analytics data feeder in your python application.Overview
Asking customers to get the developer access credentials in json and asking to use it is very unpractical and unprofessional. We have automated this process so that your application will ask the customers one time to login to google account and boom. All of his data will be there for you to analysis. If you are developing an application that is targeting to give SAAS service but requires their analytics data for your application to analyze, simply grab our fully automated script and integrate it.
Besides that, we have prepared a full GUI feature as well so that your application or even customer can choose in which data they are interested in to analyze in your application. The script is in simple flask application for the GUI feature. We are developing it in other frameworks and preparing a simple class and planning to host it in pypi in future.
Features
- Fully automated and user interactive Google Analytics Data FeedÂ
- Readmade GUI for your new python application to start in flaskÂ
- Total freedom on which data you are interested in to fetch from specific property of google analytics accountÂ
- Result in easily readable json so that you can either save in a file or put it in your favorite choice of database like postgres
Requirements
Please follow the readme file to setup in your existing or new application. We have prepared a very basic requirement.txt file which will install all the dependencies. Tested in python 2.7+ or python 3
Instructions
Steps to setup the application:
1. Unzip the application archive and open the terminal.
2. Change the directory to go to extracted folder.
3. Its better to run the python applications in virtual environment. For this, to create a virtual environment run: python3 -m venv venv. (Application is tested in python 3.6)
4. Activate virtual environment, run:
source venv/bin/activate
5. To install the required dependencies, runÂ
pip install -r requirements.txt
6. There is, client_secrets.json file in the project root. You can use your own google account client secret file in your application. You can download it from,Â
https://console.developers.google.com/apis/credentials. From this google page in your google account, you can create a project. Replace the root client_secrets.json file with your downloaded file.
7. At last run: python app.py [This will run the application in default 5000 port in localhost and can be accessed from http://localhost:5000/. You can run it in any port by editing app.py and run in wsgi in port 80 for production.]
8. From the application homepage, local default in http://localhost:5000/, You can start by connecting your google account. For this click Connect button. After logging into your account, You may get, This app isn't verified warning. This is because, your domain needs to be added under Authorized domains in your google analytics account. You can add your domain (localhost in default) under Google Analytics Account >> OAuth Consent Screen >> External >> Authorized Domains. After that, you will not recieve this error. Also please make sure you have enabled the Google Analytics API for the developer account that you are using the client secret json. Also, in your developer account, Make sure you have added the scope of Google Anaytics API from, Google Analytics Account >> OAuth Consent Screen >> External >> Add Scope.
9. Once you are connected to your google account, you can view your accounts, properties and views of selected google account from the dropdown.
10. Select the required view ids from ViewIds dropdown, select metrics and dimensions, dates and click on Fetch button to get the google analytics data.
11. While choosing the google account after clicking Connet button, choose the google account with has google analytics enabled, otherwise it will show the error flash message.
Other items by this author
Category | Scripts & Code / Python |
First release | 12 March 2020 |
Last update | 12 March 2020 |
Files included | .py, .html |