[Custom Analytics] Track installations of custom integrations

Hello there,

Today I would like to share with you a really small project, which I made out of curiosity.

I am spending quite some time developing a couple of HA custom integrations and was always interested in one question – do people actually use them? As you know, HA has an Analytics integration which shows data on the number of HA installations and integrations used by users. But, not for custom integrations.

Except if you will directly access the custom_integrations.json from the analytics web page.

Since obviously, just reading the number is not as interesting (and because I like to show off), I decided to create one of the Shields.io badges. As any of you probably know, these badges are used everywhere and for anything. So, let’s create one for our custom integrations. For this, Shields does support custom endpoints. You just need to provide JSON data with 3 required fields - schemaVersion, label and message.

https://img.shields.io/endpoint?url=YOUR_ENDPOINT

So, behold, one bad Python script later (because we are for HA integrations, we should use Python), there is a library of installation badges for all the custom integrations tracked by HA.

Since I like to share useful things, you are welcome to use the automatically generated badges library from my GitHub Page (updated every 6 hours). Or just generate your own library.

Examples

Anyway, here are a couple of examples:

AsusRouter installations - my integration statistics for all the versions
HACS installations - all the HACS installations

Latest Frigate installations - installations of latest (3.0.0) version of Frigate, no styles.

Endpoints to use

https://vaskivskyi.github.io/ha-custom-analytics/badges/INTEGRATION_NAME/total.json

https://vaskivskyi.github.io/ha-custom-analytics/badges/INTEGRATION_NAME/version-VERSION.json

Example of badge address:

https://img.shields.io/endpoint?url=https://vaskivskyi.github.io/ha-custom-analytics/badges/hacs/version-1.28.3.json

Result:

All the Shields styles are available as usual.

Keep in mind

The analytics data is available only for custom integrations, which are added to HA brands.

Obviously, the data is only valid for HA installations, which are sharing the analytics.

More features coming

Some more features might come to the custom HA analytics. As usual, I have lots of useful ideas.

Links

Repository: Vaskivskyi/ha-custom-analytics: Custom HA analytics tools and generated data (github.com)

Buy Me A Coffee

Cool, but why? you can use shields.io directly

https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.nest_protect.total

badge

1 Like

Because it’s fun, so why not :slightly_smiling_face:

How would you write a query for the version number, not for the total? E.g. version 0.3.8 of nest_protect

With a little extra work on the query :wink:

https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.nest_protect.versions['0.3.8']

Fair enough. I agree on being bad with queries :laughing: