# 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:

• Logical page views: by integrating with aurelia-router, the plugin is able to track when a user navigates to a route.
• Unhandled errors: by listening for the error event on the window object, the plugin is able to track unhandled errors.
• Logs: by integrating with aurelia-logging, the plugin is able to track log messages.

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>


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: