Tracking wordpress plugin installs

I have a plugin which is live in WordPress plugin directory. I can see how many people are installing the plugin but is there any way to check which all websites are using this plugin?

Related posts

Leave a Reply

1 comment

  1. As brasofilo noted, this is typically against the WordPress Plugin Repository guidelines. Guideline #7 specifies:

    The plugin may not “phone home” or track users without their informed,
    explicit, opt-in consent.

    You could set up an opt-in consent after the user installs the plugin that would ask the user to share information with you. You would want to send a request to a script on your own server to log information after the user opts in. And, you’ll have to add a Privacy Policy to your readme file that describes how the information is used.

    This guideline is just for the WordPress Plugin Repository, so if you hosted the plugin outside the Plugin Repository you could track installs through an activation hook. You’d probably want to include the same Privacy Policy you would if you were hosting in the WordPress Plugin Repository.

    Here’s an example that would send information to your server with the domain name of the site that installed the plugin:

    register_activation_hook(__FILE__, 'activate_my_plugin');
    function activate_my_plugin() {
        try {
            file_get_contents('http://example.com/my-plugin/activate.php?d=' . urlencode($_SERVER['SERVER_NAME']));
        } catch (Exception $ex) {
            //do nothing
        }
    }
    

    Then, you could set up an activate.php script on your server that would record the domain name somehow (like putting it in a database or emailing it to you).