Piwik\Plugins\CustomPiwikJs\

TrackerUpdater

Updates the Matomo (formerly Piwik) JavaScript Tracker "piwik.js" in case plugins extend the tracker.

Usage: StaticContainer::get('Piwik\Plugins\CustomPiwikJs\TrackerUpdater')->update();

Methods

The class defines the following methods:

  • checkWillSucceed() ash; Checks whether the Matomo JavaScript tracker file "piwik.js" is writable.
  • update() ash; Updates / re-generates the Matomo JavaScript tracker "piwik.js".

checkWillSucceed()

Checks whether the Matomo JavaScript tracker file "piwik.js" is writable.

Signature

  • It does not return anything.
  • It throws one of the following exceptions:
    • Exception — In case the piwik.js file is not writable.

update()

Updates / re-generates the Matomo JavaScript tracker "piwik.js".

It may not be possible to update the "piwik.js" tracker file if the file is not writable. It won't throw an exception in such a case and instead just to nothing. To check if the update would succeed, call checkWillSucceed().

Signature

  • It does not return anything.