Skip to content

Web app designed in Flask built to perform API calls through scheduled tasks and display the fetched data through statistics

License

Notifications You must be signed in to change notification settings

ccrisc/matomo-task-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Scheduler for Matomo

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License

About The Project

This web app designed in Flask is built to perform daily a scheduled API call from matomo analytics, the fetched data is stored it into a database and the interface serves as a management system to look aut for the API status and data statistics

The API call performed from matomo is Live.getLastVisitsDetails you can read the matomo API documentation here

Screenshot 2024-09-08 alle 20 31 55

Main functionalities:

  • API calls from Matomo Analytics
  • CRUD Operations
  • DB operations
  • Scheduled jobs
  • Automatic deployment
  • Authentication

(back to top)

Built With

css3 html5 javascript

  • The application environment is built with Flask.
  • The postgreSQL db is hosted with Supabase.
  • The app is deployed on Vercel.
  • The scheduled job is performed with Github Actions

(back to top)

Getting Started

To get a local copy up and running be sure to have the following steps checked.

Prerequisites

  • Make sure you have pip installed
  • Create your DB instance.
  • Create necessary DB tables. You can execute all the CREATE queries in db/create_tables.sql

Installation

  1. Clone the repo
    git clone https://github.com/ccrisc/matomo-task-scheduler.git
  2. Install necessary packages
    pip install -r requirements.txt
  3. To work on your local environment create a .env file in the main root of the project and define the following variables
    ENVIRONMENT=development
    SUPABASE_HOST=localhost
    SUPABASE_PORT=5432
    SUPABASE_DB_NAME=matomo_task_scheduler
    SUPABASE_PASSWORD=xxxx (you delete the row on localhost if no username is set)
    SUPABASE_USER=xxxx (you delete the row on localhost if no pw is set)
    FLASK_SECRET_KEY=xxxx
    MATOMO_API_URL=xxxx
  4. Start your Flask app
    python app.py
  5. Visit http://127.0.0.1:5000

Set up production environment

(back to top)

Usage

Login

Login with your user credentials. If you successfully set up the db you can log in with the following credentials:

username: demo password: abcd

Screenshot 2024-09-08 alle 20 29 07

You will be automatically logged out after 30 minutes of inactivity

Dashboard

The dashboard shows on the left the navigation sidebar. You can expand it by clicking on the burger menu. On the top right you can perform log out and read the latest messages.

The dashboard shows the last api call status if it was successful or if it failed and datetime of when it was performed. Screenshot 2024-09-08 alle 20 56 24

Users

Only if the current user logged has admin privilege he can access the users management section.

In the users table you have an overview of all your users that have an account. The table can be filtered by column

Screenshot 2024-09-08 alle 21 03 16

CRUD Operations:

You can create a NEW USER by clicking the button on the top right of the table. You will be asked to specify the username, the password and if the user is an admin or not.

Screenshot 2024-09-08 alle 21 10 18

By clicking the EDIT button you can proceed to edit data for that specific user

By clicking the DELETE button you will remove the selected user. You will be asked for confirmation prior irreversible delete.

Screenshot 2024-09-08 alle 21 14 28

Api Calls

Here you will have an overview of all the API calls performed and if they were successful or not. In the table you see the column state that indicates if the call was successful (green) or if it failed (red). At the same time if the call failed then it will be shown the details of the error.

Screenshot 2024-09-08 alle 21 17 06

Statistics

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you think you found a bug in this repo, you can submit an issue.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

For more details see See CONTRIBUTING.md

(back to top)

License

Distributed under the GNU GENERAL PUBLIC License. See LICENSE.txt for more information.

(back to top)

About

Web app designed in Flask built to perform API calls through scheduled tasks and display the fetched data through statistics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published