Metadata-Version: 2.1
Name: udata-piwik
Version: 1.5.0
Summary: Piwik support for uData
Home-page: https://github.com/opendatateam/udata-piwik
Author: OpenDataTeam
Author-email: contact@opendata.team
License: LGPL
Keywords: udata piwik
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python
Classifier: Environment :: Web Environment
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: Software Distribution
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: udata (>=1.6.1)
Provides-Extra: test
Requires-Dist: mock (==2.0.0) ; extra == 'test'
Requires-Dist: pytest (==4.3.1) ; extra == 'test'
Requires-Dist: pytest-flask (==0.14.0) ; extra == 'test'
Requires-Dist: pytest-mock (==1.10.2) ; extra == 'test'
Requires-Dist: retrying (==1.3.3) ; extra == 'test'

# udata-piwik


[![Join the chat at https://gitter.im/opendatateam/udata][gitter-badge]][gitter-url]

This plugin provide integration between [udata][] and [Piwik/Matomo](https://matomo.org/)

## 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**:

```shell
pip install udata-piwik
```

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

```python
PLUGINS = ['piwik']
# Piwik/Matomo site IDs
# this site will track front (template) events
PIWIK_ID_FRONT = 1
# this site will track back (API) events
PIWIK_ID_API = 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

```python
# 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

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

[circleci-url]: https://circleci.com/gh/opendatateam/udata-piwik
[circleci-badge]: https://circleci.com/gh/opendatateam/udata-piwik.svg?style=shield
[gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/opendatateam/udata
[udata]: https://github.com/opendatateam/udata

# Changelog

## 1.5.0 (2019-12-30)

- Independant Matomo site ids for front and api tracking :warning: breaking change, you need to set `PIWIK_ID_FRONT` and `PIWIK_ID_API` in settings (they can be the same) [#173](https://github.com/opendatateam/udata-piwik/pull/173)

## 1.4.2 (2019-12-13)

- Improve detect_by_url error handling [#171](https://github.com/opendatateam/udata-piwik/pull/171)

## 1.4.1 (2019-05-15)

- Fix bulk handling of unicode URLs [#139](https://github.com/opendatateam/udata-piwik/pull/139)

## 1.4.0 (2019-03-27)

- Consolidate and expose default settings [#119](https://github.com/opendatateam/udata-piwik/pull/119)
- Process API calls in bulk [#120](https://github.com/opendatateam/udata-piwik/pull/120)

## 1.3.2 (2019-01-14)

- Add `PIWIK_SCHEME` config support [#104](https://github.com/opendatateam/udata-piwik/pull/104)

## 1.3.1 (2018-11-05)

- Ensure JS goals handling waits for `uData` object to be present [#91](https://github.com/opendatateam/udata-piwik/pull/91)

## 1.3.0 (2018-10-11)

- Advanced search tracking: display results count and categories (datasets, reuses, organizations) [#88](https://github.com/opendatateam/udata-piwik/pull/88)
- Lower jobs piriority to `low` [#90](https://github.com/opendatateam/udata-piwik/pull/90)
- Depends on `udata>=1.6.1`

## 1.2.0 (2018-06-06)

- Simpler and more reliable metrics computation [#54](https://github.com/opendatateam/udata-piwik/pull/54)

## 1.1.1 (2018-03-15)

- Handle multiple resources for same url [#49](https://github.com/opendatateam/udata-piwik/pull/49)

## 1.1.0 (2018-03-13)

- Refactor `counter.handle_downloads` - fix [#1421](https://github.com/opendatateam/udata/issues/1421)
- Switch to `flask-cli` and endpoint-based commands (requires `udata>=1.3`) [#33](https://github.com/opendatateam/udata-piwik/pull/33)
- Expose the new `udata.tasks` endpoint [#39](https://github.com/opendatateam/udata-piwik/pull/39)
- Expose the new `udata.views` endpoint [#41](https://github.com/opendatateam/udata-piwik/pull/41)
- Add content tracking options in configuration paramaters [#42](://github.com/opendatateam/udata-piwik/pull/42)

## 1.0.2 (2017-12-20)

- Fix version number
- Fix README on pypi

## 1.0.1 (2017-12-20)

- Fix packaging issue

## 1.0.0 (2017-12-19)

- Add (automated) tests against a Piwik instance [#20](https://github.com/opendatateam/udata-piwik/issues/20)
- Handle download count on latest url for (community) resources [#30](https://github.com/opendatateam/udata-piwik/pull/30)

## 0.9.3 (2017-12-11)

- Add a timeout to `analyze()` [#19](https://github.com/opendatateam/udata-piwik/pull/19)

## 0.9.2 (2017-12-11)

- Add a timeout to `track()` [#18](https://github.com/opendatateam/udata-piwik/pull/18)

## 0.9.1 (2017-01-10)

- Fix build and packaging

## 0.9.0 (2017-01-10)

- First published release



