Sync some matomo tables from MySQL to PostgreSQL.
For example to create custom metabase dashboards:
The tables currently synced are:
matomo_log_conversionmatomo_log_visitmatomo_log_link_visit_actionmatomo_log_action
Adjust your .env from the .env.example then run :
docker run --env-file .env ghcr.io/betagouv/matomo-to-pg/syncYou first need to create your PostgreSQL database structure:
Example with docker:
docker cp ./pg-init.sql [id]:/tmp/pg-init.sql
docker exec -ti [id] psql --dbname matomo -U matomo -f /tmp/pg-init.sql
Run from source with node --env-file=.env src/index.mjs
To update the source or target database typings, run yarn kysely-codegen --print with the DATABASE_URL of your choice.
- https://developer.matomo.org/guides/database-schema#log-data-persistence-visits
- http://www.sqlines.com/online
- https://matomo.org/faq/how-to/how-do-i-write-sql-queries-to-select-visitors-list-of-pageviews-searches-events-in-the-matomo-database/#sql-query-to-select-all-visits-and-actions-for-a-specific-website-id

