Skip to content

regardscitoyens/stats-analytics

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
js
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Stats-Analytics

Collects automatically daily stats (users, pageviews...) from Google Analytics monitored websites and version results in data.

Data is redistributed as OpenData under (ODbL licence).

Install

  • Create a virtualenv analytics using virtualenvwrapper and install dependencies:
sudo apt-get install virtualenvwrapper
source $(which virtualenvwrapper.sh)
mkvirtualenv analytics
pip install -r requirements.txt
  • Or install dependency library globally:
sudo pip install google-api-python-client

Configure

  • Create a new project in the Google API Console and create a service account. This will let you download a json file with credentials.

  • Move this file to the current directory and rename it ga-pi-credentials.json. It should look similar to ga-api-credentials.json.example.

  • In the Google API Console, click on the newly created accound to read its details and copy its e-mail address. Then connect to Google Analytics Admin Seettings and add a user with this e-mail and "Read & Analyze" permissions.

  • Copy settings.py.example and edit it to setup chosen websites (VIEWS) and resulting data (FIELDS).

cp settings.py{.example,}

Run

  • Collect all data
./collect.py
  • Book automatic git versioning of data with update.sh and a cronjob.
./update.sh

Crontab:

m  h  dom mon dow   command
5  3   *   *   *    $PATH_TO_THIS_REPO/update.sh 2>&1

About

Export des stats de visites de RegardCitoyens, NosDéputés et NosSénateurs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published