Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LucasHild/flask-matomo
Track requests to your Flask website with Matomo
https://github.com/LucasHild/flask-matomo
Last synced: 9 days ago
JSON representation
Track requests to your Flask website with Matomo
- Host: GitHub
- URL: https://github.com/LucasHild/flask-matomo
- Owner: LucasHild
- License: mit
- Created: 2018-03-09T17:31:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-30T19:19:09.000Z (about 4 years ago)
- Last Synced: 2024-04-14T12:12:37.405Z (8 months ago)
- Language: Python
- Homepage: https://flask-matomo.readthedocs.io
- Size: 10.7 KB
- Stars: 13
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - LucasHild/flask-matomo - Track requests to your Flask website with Matomo (Python)
README
# Flask-Matomo
![](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
[![PyPI](https://img.shields.io/pypi/v/flask-matomo.svg?style=flat-square&colorB=dfb317)](https://pypi.org/project/flask-matomo/)
[![Docs](https://img.shields.io/badge/docs-readthedocs-red.svg?style=flat-square)](https://flask-matomo.readthedocs.io)Flask-Matomo is a library which lets you track the requests of your Flask website using Matomo (Piwik).
## Installation
```
pip install flask-matomo
```## Usage
```python
from flask import Flask, render_template
from flask_matomo import *app = Flask(__name__)
matomo = Matomo(app, matomo_url="https://matomo.mydomain.com",
id_site=5, token_auth="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")@app.route("/")
def index():
return render_template("index.html")if __name__ == "__main__":
app.run()
```In the code above:
1. The *Matomo* object is created by passing in the Flask application and arguments to configure Matomo.
2. The *matomo_url* parameter is the url to your Matomo installation.
3. The *id_site* parameter is the id of your site. This is used if you track several websites with on Matomo installation. It can be found if you open your Matomo dashboard, change to site you want to track and look for &idSite= in the url.
4. The *token_auth* parameter can be found in the area API in the settings of Matomo. It is required for tracking the ip address.## Meta
Lucas Hild - [https://lucas-hild.de](https://lucas.hild.de)
This project is licensed under the MIT License - see the LICENSE file for details