Download plugins/CustomJsTracker/CustomJsTracker.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CustomJsTracker/CustomJsTracker.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/plugins/CustomJsTracker/CustomJsTracker.php
-
curl -L -o CustomJsTracker.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CustomJsTracker/CustomJsTracker.php
1.37 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | |
| */ | |
| namespace Piwik\Plugins\CustomJsTracker; | |
| use Piwik\Container\StaticContainer; | |
| use Piwik\Log; | |
| use Piwik\Plugin; | |
| class CustomJsTracker extends Plugin | |
| { | |
| public function registerEvents() | |
| { | |
| return array( | |
| 'CoreUpdater.update.end' => 'updateTracker', | |
| 'PluginManager.pluginActivated' => 'updateTracker', | |
| 'PluginManager.pluginDeactivated' => 'updateTracker', | |
| 'PluginManager.pluginInstalled' => 'updateTracker', | |
| 'PluginManager.pluginUninstalled' => 'updateTracker', | |
| 'Updater.componentUpdated' => 'updateTracker', | |
| 'Controller.CoreHome.checkForUpdates.end' => 'updateTracker', | |
| 'CustomJsTracker.updateTracker' => 'updateTracker', | |
| ); | |
| } | |
| public function updateTracker() | |
| { | |
| try { | |
| if (Plugin\Manager::getInstance()->isPluginActivated('CustomJsTracker')) { | |
| $trackerUpdater = StaticContainer::get('Piwik\Plugins\CustomJsTracker\TrackerUpdater'); | |
| $trackerUpdater->update(); | |
| } | |
| } catch (\Exception $e) { | |
| Log::error('There was an error while updating the javascript tracker: ' . $e->getMessage()); | |
| } | |
| } | |
| } | |