I have Matomo On-Premise on my server and use it for a Wordpress site (therefore not the Wordpress plugin, because I need to use widgetize)
What I basically want to do is to add a reset-button on the frontend of Wordpress to delete all statistics of this site.
How can I address the matomo tables from wordpress side without hardcoding host, db-name, etc.? Like I can do inside Wordpress with
global $wpdb; $delete = $wpdb->query("TRUNCATE TABLE " . $wpdb->prefix . "someTable") or die(mysql_error());
Is there a way to connect similar to Matomos DB?
I need ta connection to the DB to do
DELETE FROM matomo_log_visit WHERE idsite = X; DELETE FROM matomo_log_link_visit_action WHERE idsite = X; DELETE FROM matomo_log_conversion WHERE idsite = X; DELETE FROM matomo_log_conversion_item WHERE idsite = X;
Thank you. Any help would be great.