Piwik support for uData
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
requirements
tests
udata_piwik
.gitignore
.pyup.yml
CHANGELOG.md
MANIFEST.in
README.md
bumpr.rc
docker-compose.yml
pep8.rc
setup.cfg
setup.py
tasks.py

README.md

uData-piwik

Build status Join the chat at https://gitter.im/opendatateam/udata

This plugin provide integration between uData and Piwik

Compatibility

udata-piwik requires Python 2.7+ and uData.

Installation

Install uData.

Remain in the same virtual environment (for Python) and use the same version of npm (for JS).

Install udata-piwik:

pip install udata-piwik

Modify your local configuration file of udata (typically, udata.cfg) as following:

PLUGINS = ['piwik']
# Tracked site id in Piwik
PIWIK_ID = 1
PIWIK_SCHEME = 'https'
PIWIK_URL = 'stats.data.gouv.fr'
PIWIK_AUTH = '<32-chars-auth-token-from-piwik>'
# Mapping of piwik goals {'<name_in_udata>': <id_in_piwik>}
# All keys are required
PIWIK_GOALS = {
    'NEW_DATASET': 1,
    'NEW_REUSE': 2,
    'NEW_FOLLOW': 3,
    'SHARE': 4,
    'RESOURCE_DOWNLOAD': 5,
    'RESOURCE_REDIRECT': 6,
}
# `client.track` method `requests` timeout
PIWIK_TRACK_TIMEOUT = 60  # in seconds
# `client.analyze` method `requests` timeout
PIWIK_ANALYZE_TIMEOUT = 60 * 5  # in seconds

Optional configuration

# Content tracking options. Default: None
#   - 'all': track all impressions
#   - 'visible': track impressions of visible items only (default refresh: 750 ms)
PIWIK_CONTENT_TRACKING = 'visible'

Testing on local env

$ docker-compose up
$ pip install -r requirements/test.pip
$ pytest