Plugin Author
Thomas
(@tsteur)
Hi @2candela2
when you’re using Matomo for WordPress, then you won’t need to set up any cron as we’re utilising the WP-Cron automatically. Matomo Cron is configured automatically and runs whenever the WordPress cron runs.
Was our user interface maybe suggesting that you should be setting up a cron? That would be a bug and we’d look into fixing that.
Hi @thomas
Thanks for your patience.
The other site that I have your plugin installed has not much traffic. The one where I am having problems has more traffic. So, reading the documentation on the link above, in the first paragraph:
If your website has more than a few hundreds visits per day (bravo!), waiting for Matomo to process your data may take a few minutes. The best way to avoid these waiting times is to set up a cron job on your server so that your data is automatically processed every hour.
So I decided to use a cron job.
Thanks and have a nice morning 🙂
And I am intrigued about the url. Do I make a direct access in a folder to the app folder? So the url is https://test.com/matomo that goes to https://test.com/wp-content/plugins/matomo/app/
Thanks again
Plugin Author
Thomas
(@tsteur)
Thanks for this @2candela2 I’ve updated the guide below that part where it mentions that it won’t be needed for WordPress in the hope it will be more visible.
Regarding the URL you could add a redirect so that /matomo
goes to /wp-content/plugins/matomo/app/
but it’s not needed and entirely up to you. I don’t think it’s possible to directly access it through /matomo
but a redirect could work. Not sure if that helps?
Hi @tsteur
Everything goes ok with wp-cron, but I have read that it is better in general for wp-cron to run from the system for optimization on performance. So I decided to test it today.
https://tommcfarlin.com/wordpress-cron-jobs/
https://kinsta.com/knowledgebase/disable-wp-cron/
https://chemicloud.com/kb/article/disable-wp-cron-wordpress/
in /etc/cron.d/wordpress
#wordpress
MAILTO="test@test.com"
5 * * * * www-data /usr/bin/php /path_to_wp/wp-cron.php > /var/log/wordpress/wordpress.log
The /var/log/wordpress/wordpress.log propietary is www-data
If I have no problems, I will close the issue.
But I have a doubt about the time on your cron.
In Diagnosis system report, the Sync users $ sites is run just when people here starts to work.
Crons
Server time 2021-03-27 10:40:58
Blog time 2021-03-27 10:40:58 Below dates are shown in blog timezone
Sync users & sites Next run: 2021-03-28 09:07:38 (22 hours 26 min) Last started: 2021-03-27 09:10:47 (-1 hours 30 min). Last ended: 2021-03-27 09:10:47 (-1 hours 30 min). Interval: daily
Archive Next run: 2021-03-27 11:07:38 (26 min 40s) Last started: 2021-03-27 10:37:13 (-3 min 45s). Last ended: 2021-03-27 10:37:18 (-3 min 40s). Interval: hourly
Update GeoIP DB Next run: 2021-04-10 09:07:38 (13 days 22 hours)
So I change the hour with the https://wordpress.org/plugins/wp-crontrol/ I edited matomo_scheduled_sync to run earlier. This is the hook name, isn’t it?
Thanks very much for your support, you have many questions in the support forum what is good news, isn’t it? Many people that uses WordPress is deciding privacy and not Google Analytics! Congratulations 🙂
Hello again,
The cron was working ok, but the log was empty, so I studied the WordPress cron and debug and take it out of the public for security. What I wrote in wp-config.php
// Turn debugging on
define('WP_DEBUG', true);
// Tell WordPress to log everything to /wp-content/debug.log
define('WP_DEBUG_LOG', '/var/log/wordpress/wordpress_' . date("ymd") . '.log');
define( 'WP_DEBUG_DISPLAY', false );
//desactivate WP cron
define('DISABLE_WP_CRON', true);
The owner in /var/log/wordpress/ is www-data.
The system cron job
#wordpress
MAILTO="test@test.com"
5 * * * * www-data /usr/bin/php7.3 /path_wordpress/wp-cron.php
Now everything works perfect. Thanks a lot for the plugin and the support! 🙂
-
This reply was modified 3 years ago by 2candela2.
Plugin Author
Thomas
(@tsteur)
Great to hear it works now @2candela2 ! And thanks for all the research and troubleshooting. Very appreciated!