getButterfly Logo getButterfly

I am fiddling with the idea to capture WordPress plugin usage data. Instead of using GET or POST requests, I thought of asynchronously sending an AJAX request once.

The $('#element') will most likely contain a switch to inform the plugin that data has been sent. This switch may reset every 3 or 6 months, in case the hosting provider updates their software.

if ((window.location.href.indexOf('imagepress_admin_page') > -1) && ($('#element').length > 0)) {
    var phpVersion = $('.php-version').text();
    var mysqlVersion = $('.mysql-version').text();
    var wpVersion = $('.wp-version').text();
    var siteUri = window.location.href;

        url: "",
        type: "POST",
        data: JSON.stringify({
            phpVersion: phpVersion,
            mysqlVersion: mysqlVersion,
            wpVersion: wpVersion,
            siteUri: siteUri
        dataType: "json",
        success: function(response) {
        error: function(response) {

Note that the code is just the initial idea, it doesn’t actually extract the data using PHP or an API. I am still considering it, and I am testing it with one free plugin to measure the client load and server impact.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a Reply

Your email address will not be published. Required fields are marked *