Building Telemetry for CraftCMS
The 'problem'
At the time of writing, we have 10 plugins on the Craft Plugin Store. That's a pretty sizeable number for a small shop like ours. They run the gamut from large field-type plugins such as Maps, or SEO, to smaller utility plugins like Sidebar Entry Types or Logs (we even have another couple in the works).
We're lucky that a number of these plugins have a sizeable audience and hopefully provide a ton of value to Craft developers and their users. SEO, for example, has over 12,800 users, Maps 9,300 and Logs almost 6,000.
But wait... there's a problem with those numbers.
As it currently stands the values Craft quotes on the plugin store are based solely on the install numbers. When a user hits the install button on the plugin store, that plugin will get an incremental bump on the install number. As you can probably see, only logging the initial install is only tracking part of the story. We're not caturing those users who have deactivated or completely uninstalled it.
What we need is a way to accurately log active installs of a plugin. This will give us a true picture of the usage. Furthermore, we should be able to see what versions of the plugin people are using and more specific information on 'Edition' usage – more on that later.
Okay, but why?
Like all good Saas elevator pitches; 'we scratched our own itch!'. We felt we could be doing a better job understanding our plugins if we better knew our users.
In truth, the primary driver was to get a better understanding of who was trying our new 'PRO' edition of Maps. We recently spent a ton of time overhauling the plugin and building out several new features to make it more useful to our users. Maintaining and building on a free plugin is expensive work, and we wanted to see what the appetite was for a selection of paid-for features, layered on top of the core plugin.
Unfortunately, the numbers we mentioned earlier don't include the different editions that a user might be using and the only way we know for sure that someone is using the PRO version is when they purchase.
Wouldn't it be great if we knew the number of users who are actively trying each version?
The second part to all this centred around the notion that if we wanted this, it was likely that others would too.
Introducing Telemetry
Telemetry is a two-part solution; a package that sits with the Craft install and a web-app that Ether host to manage the anonymous data and serve as an interface for interrogating it.
Let's start with the Craft part. Telemetry will be an opt-in solution for plugin developers who want to start collecting this data on their plugin usage. It's a simple composer package that gets included and that's it!
We then grab all the information we need, such as the plugin name and changes to the status of the plugin on that Craft Install.
Now on to the web-app. This is a simple React app that reads the data from a GraphQL API
Privacy First
One thing we were really keen to set out before anything else was our vision of privacy. We hate the way the web has been hijacked by invading trackers and cross-party sharing of data – this is not the kind of internet we want to be a part of.
All data that we collect is totally anonymous – nothing we collect can track that information back to an individual or business. We also wanted it to be really easy for developers building Craft sites to opt their site out of analytics. We feel it somewhat defeats the purpose of the solution, but we feel that it's better to under-represent the numbers than over-represent like they are now.
Finally, this is an opt-in solution. Plugin developers can decide if they want to use this solution with their plugins. If people find it useful, we hope many of those building in the Craft community will use it, if not we still feel we have a great tool for us to use.
Open-source codebase
To further reinforce our openness to transparency, we're open-sourcing all the code. That includes the Craft module in addition to the web-app code. We hope that by doing this the community can help shape the product and shine a light on anything we can be doing better.
Cool, so when an I start using it?
Well, we're not quite ready yet, but soon. Once we've been running it on our plugins for a few months and worked out any kinks, we'll open it up to other plugin devs.
If you're a plugin dev – get in touch and let us know you'd like to take Telemetry for a spin.