How are community plugin download stats calculated?


it’s nice that Obsidian counts how many times community plugins have been downloaded. The stats are visible in Obsidian itself (in the community plugins list), and on GitHub as a community-plugin-stats.json file.

The JSON file even tells how many times specific versions of a plugin have been downloaded.

I’d like know, how these statistics are counted?

  • If I upgrade a plugin that I’ve already downloaded, does it count as a download too?
  • I assume that if I install a plugin to five of my vaults, it is registered as five downloads, not one?

Thanks! :slightly_smiling_face:

1 Like

I think I found an answer to this. GitHub API can be queried to get release download stats, and when I’m quickly comparing the stats of my own plugin provided by the GitHub API to Obsidian’s community-plugin-stats.json file, they seem to match, so I guess Obsidian simply uses the same API to get download stats.

Instructions on how to acess GitHub API in terminal: Finding the download count of GitHub releases – Andy Balaam's Blog

curl -s | egrep '"name"|"download_count"'

(Replace andybalaam/rabbit-escape with the plugin’s repository that you want to check).

Based on this assumption, I guess that:

  • If I upgrade a plugin that I’ve already downloaded, it is counted as a new installation/download, because it causes manifest.json, main.js and styles.css to be downloaded again.
  • If I install a plugin to five of my vaults, my quick test looks like the download count is increased also for every repetitive installation.

The releases API lists download count per assets per release. Which asset is counted in community-plugin-stats.json file? I am not sure between main.js and manifest.json files. It is one of them!

Able to verify that it is manifest.json :slightly_smiling_face:

1 Like

Yes, manifest.json it is. Here’s a link to a script that updates the statistics automatically: obsidian-releases/update-stats.js at master · obsidianmd/obsidian-releases · GitHub