Matomo Services Lite is a lightweight and extendable library designed to help you manage data easily using the Matomo in your PHP projects.
Disclaimer: This package is not an official product of Matomo. The developers accept no responsibility for any issues, discrepancies, or damages that may arise from its use.
- PHP 7.0 or higher (including PHP 8)
You can add this package to your projects via Composer:
composer require ceytek-labs/matomo-services-lite
- Actions
- Devices Detection
- Events
- Marketing Campaigns Reporting
- Sites Manager
- Users Manager
- Visits Summary
The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles, Events, Content Tracking, File Downloads and Clicks on external websites.
The following example demonstrates how to manage data in a Actions document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->actions()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->get();
echo '<pre>'; print_r($result);
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->actions()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getPageUrls();
echo '<pre>'; print_r($result);
The DevicesDetection API lets you access reports on your visitors devices, brands, models, Operating system, Browsers.
The following example demonstrates how to manage data in a Devices Detection document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->devicesDetection()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getType();
echo '<pre>'; print_r($result);
The Events API lets you request reports about your users' Custom Events.
The following example demonstrates how to manage data in a Devices Detection document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->events()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getAction();
echo '<pre>'; print_r($result);
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->events()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getCategory();
echo '<pre>'; print_r($result);
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->events()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getName();
echo '<pre>'; print_r($result);
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->events()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->setIdSubtable('<your-id-subtable>')
->getNameFromActionId();
echo '<pre>'; print_r($result);
API for plugin MarketingCampaignsReporting
The following example demonstrates how to manage data in a Marketing Campaigns Reporting document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->marketingCampaignsReporting()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->getName();
echo '<pre>'; print_r($result);
The SitesManager API gives you full control on Websites in Matomo (create, update and delete), and many methods to retrieve websites based on various attributes.
The following example demonstrates how to manage data in a Sites Manager document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->sitesManager()
->getAllSites();
echo '<pre>'; print_r($result);
The UsersManager API lets you Manage Users and their permissions to access specific websites.
The following example demonstrates how to manage data in a Users Manager document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->usersManager()
->setIdSite('<your-id-site>')
->setAccess('<your-access>')
->getUsersWithSiteAccess();
echo '<pre>'; print_r($result);
VisitsSummary API lets you access the core web analytics metrics (visits, unique visitors, count of actions (page views & downloads & clicks on outlinks), time on site, bounces and converted visits).
The following example demonstrates how to manage data in a Visits Summary document:
use CeytekLabs\MatomoServicesLite\Matomo;
$result = Matomo::make()
->setApi('<your-api-url>')
->setToken('<your-token>')
->visitsSummary()
->setIdSite('<your-id-site>')
->setPeriod('<your-period>')
->setDate('<your-date>')
->get();
echo '<pre>'; print_r($result);
Feel free to submit a pull request or report an issue. Any contributions and feedback are highly appreciated!
This project is licensed under the MIT License.