How reinmengelberg/conversionapi works
Project type and purpose
• This is a Matomo “ConversionApi” plugin, written in PHP, that intercepts Matomo visit data, enriches/transforms it, and forwards conversions to external advertising platforms (Google, Meta, LinkedIn) via their Conversion APIs.
• It integrates into the Matomo core as a plugin, exposing settings pages (Twig templates), controllers for API endpoints, scheduled tasks, and uses a set of services to authenticate, process, and send data.
File structure
• Top-level files:
• Controller.php, ConversionApi.php – entry points for web/API requests
• Tasks.php – cron tasks for asynchronous processing
• plugin.json, config/*.php – plugin metadata and configuration
• templates/*.twig – UI views for settings
• docs/ & screenshots/ – documentation
• Exceptions/, Settings/, Services/ – main PHP namespaces
• Services/ subdirectories:
• Auth – obtains OAuth tokens
• Processors – per-platform data formatting & API calls
• Visits – data retrieval, expansion, formatting, hashing
• ConversionApiManager – central orchestration service
• Settings/ defines typed configuration entities for API keys, consent, dimensions, events.
README
• Minimal README; plugin description and purpose are clear from file names and Matomo conventions.
Final advice
• Pipelines sequentially (VisitData → Expand → Format → Hash)
• Loops or retries for failed API calls (optional)
• Labels include both class names and responsibilities
• Don’t overthink—more granular components make the architecture clearer to maintain and extend.