Coder Social home page Coder Social logo

regardscitoyens / stats-analytics Goto Github PK

View Code? Open in Web Editor NEW
3.0 11.0 0.0 1.39 MB

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

Home Page: https://regardscitoyens.github.io/stats-analytics/

License: GNU General Public License v3.0

Python 32.97% Shell 5.13% HTML 61.90%

stats-analytics's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.