Showing how many times is plugin activated or deactivated

Although 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.org/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.