I develop a custom plugin for my needs, and I stuck on one task.
I need some kind of solution, to show on my website how many times is that plugin activated or deactivated on every site where will be installed.
So, to be clear. I need to show on my site some counter which should count activations and deactivations on every other site where is plugin installed.
Any kind of help is welcomed.
Thanks in advance.
I develop a custom plugin for my needs, and I stuck on one task.
I need some kind of solution, to show on my website how many times is that plugin activated or deactivated on every site where will be installed.
So, to be clear. I need to show on my site some counter which should count activations and deactivations on every other site where is plugin installed.
Any kind of help is welcomed.
Thanks in advance.
Share Improve this question asked Jul 5, 2019 at 20:06 upss1988upss1988 178 bronze badges1 Answer
Reset to default 0Although you might have already managed to solve the problem you faced, here's few thoughts.
You could use register_activation_hook(), register_deactivation_hook() and register_uninstall_hook() functions to trigger a wp_remote_post() call to your (custom) API endpoint to count the times when your plugin is activated, deactivated or deleted.
If the recieving site, where you keep track of the different counts, happens also to be a WordPress site, then you can find information about adding custom end point from the developers handbook, https://developer.wordpress/rest-api/extending-the-rest-api/adding-custom-endpoints/
As a note on privacy, you might also inform the plugin users that your plugin is doing something like this.