Manuel Guilbault's Blog

Presenting aurelia-telemetry

Adding telemetry to an Aurelia application is a tedious and repeatable task, at least when it comes to bootstrapping and integrating with the framework. This is what the aurelia-telemetry plugin intends to solve.

Features

The plugin defines an abstraction for a telemetry client, and integrates it with Aurelia so all different kinds of telemetry are automatically gathered:

Additionally, the plugin defines a trackEvent binding behavior, which can be added to any .delegate, .trigger, or .call binding, so a custom event can be tracked when the binding is triggered:

<button click.delegate="doSomething() & trackEvent:'something-happened'">Do something</button>

Here, a 'something-happened' custom event is tracked each time the button is clicked.

The binding behavior can also be passed an object containing additonal properties as its second parameter, and this object will be sent to the telemetry client along with the event name:

<button click.delegate="doSomething() & trackEvent:'something-happened':{ param: 'value' }">Do something</button>

Adapters

The plugin doesn’t contain any specific telemetry client. Instead, it just defines a TelemetryClient abstract class, which you can extend into an adapter for your favorite telemetry framework. Alternatively, you can use one of the existing adapters, provided as additional plugins:

Contributing

Of course, help is welcome. If you want to create an adapter for another telemetry provider, or propose a new feature, don’t hesitate to either send a pull request or engage discussion.

#Aurelia #JS #Web