How to remove unnecessary visits from Piwik and Matomo

To remove unnecessary visits from Piwiki and Matomo, you can embed a link in the Visitors log report.
 

1 - create a file delete.php in the root directory of Piwik

 

delete.png
2 - Open the file /plugins/Live/templates/_dataTableViz_visitorLog.twig

and add after
                {% endif %}
                {% if visitor.getColumn('visitorTypeIcon') or visitor.getColumn('countryFlag') %}
                    <br/>
                {% endif %}
lines
               {# smirnov #}
                 Visit ID {{ visitor.getColumn("idVisit") }} <a href="https://<SITE>/<PIWIK DIR>/delete.php?id={{ visitor.getColumn("idVisit") }}" target="_blank" onclick="return confirm('Are you sure?')">Delete</a>
                <br/>
 

3 - as a result, we get a very convenient button in the "Visitors Log" report, which deletes the visit you do not need.

piwik_button_delete.png