Get detailed download stats for plugins

Recently I was checking the downloads of a plugin in the plugin directory. In the “Advanced View” of a plugin you will find a “Downloads Per Day” graph with the numbers from the past 267 days. Let’s take a look at the stats for the poplar Antispam Bee plugin:

Downloads per day for Antispam Bee

When you hover over the graph, you will find the date an number of downloads of that day. But I wanted to know the summary of the downloads in the first few weeks after the latest release (the spike in the graph) and writing down all numbers manually to add them up would have been a bit too much work. So how could I get those numbers more easily?

Get the numbers from the “Advanced View” source code

My first attempt was to inspect the graph in the browser, but unfortunately the SVG did not have the numbers in it. But then just below that I’ve found a quite promising element:

<svg width="611" height="350" aria-label="A chart." style="overflow: hidden;">
<div aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;">

The CSS properties of the DIV hides the element from the visible view. If you want to see the table, just deactivate the CSS properties in the inspector. Then you can copy the table into Excel/Calc or similar programs.

The table is not available in the source code view of the page, as the graphs and the hidden table is generated from data that is loaded in an AJAX request after the initial page load. And here we can get the data in another way

Get the numbers from the API

There are some API endpoints for that are not widely known and documented. But some of them are really helpful for various use-cases. The “Advanced View” itself is using four endpoints. One of them will get us the raw downloads numbers as a JSON object:

This is the call similar to the one made in the “Advanced View” getting the numbers for the past 267 days. The JSON object will look like this:

	"2020-06-07": "1520",
	"2020-06-08": "2309",
	"2020-06-09": "2209",

If you want to get the downloads stats in a program, using the JSON from the REST API endpoint is the better way. With the undocumented historical_summary=1 parameter you can get the aggregated numbers for today, yesterday, last week or all time.


Even after using WordPress so many years, there are still things I can find on I haven’t seen before. I have used the API before, but the table was new to me and for my use-case easier to use.

I would still highly recommend to check out the other API endpoints, not only for other stats but also to get more information to an individual theme or plugin.

Posted by

Bernhard is a full time web developer who likes to write WordPress plugins in his free time and is an active member of the WP Meetups in Berlin and Potsdam.

Leave a Reply

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