How to fix Matomo/Piwik update configureSegments() must be public

Problem:

When trying to update your Matomo (previously called Piwik) installation, you see an error message like

Fatal error: Access level to Piwik\Plugins\ExampleTracker\Columns\ExampleActionDimension::configureSegments() must be public (as in class Piwik\Columns\Dimension) in /usr/www/users/user/piwik/plugins/ExampleTracker/Columns/ExampleActionDimension.php on line 57

Solution:

Delete the plugins/ExampleTracker folder in the Matomo installation folder. It contains an example plugin for an old version of Piwik that is not needed any more.

Original source for the fix: Matomo forums