There is generic events you could use, using API method:
But how to use that in registerEvents in a plugin:
public function registerEvents()
{
return [
'API.SitesManager.updateSite.end' => ['function' => 'siteUpdated']
];
}
public function siteUpdated($array) {
//$values = implode(",", $array);
$values = gettype($array);
$log = "value is $values";
return $log;
);
}
This returns NULL, and I have looked for examples for this, but the docs isn’t clear for me:
https://developer.matomo.org/api-reference/events#apipluginnamemethodname
The normal thing, you post a question, then you realize, that you solved it…
public function registerEvents()
{
return [
'API.SitesManager.updateSite.end' => 'siteUpdated'
];
}
public function siteUpdated($null, $event) {
$params = $event['parameters'];
$id = $params['idSite'];
);
}
What got me confused was the first parameter, I never relized that it is null, so the array is in the second paramater.
1 Like