## Introduction

The Bitmovin Player SDKs offer a variety of playback events, generally triggered by user interactions like play/pause/seek, but also by playback-inherent changes like an ABR quality change, Timed metadata becoming available, etc. Events are also triggered when something unexpected happens, like a network error or an incompatible codec.

A complete list of the available events can be found on each Player SDK:

[Web SDK Events](🔗) [iOS SDK Events](🔗) [Android SDK Events](🔗) [Roku SDK Events](🔗)

## Subscribing to Events

Most of the Analytics/Metrics Report Systems can leverage the event-based player to collect and capture playback-related data. To listen/subscribe to the events, an [event handler](🔗) is needed. The event handler will specify the logic required to connect to the Analytics/Metrics System, which in most of the cases will make use of an API or dedicated SDK to communicate.

The following Javascript example code shows how to subscribe to a player event and print out the data:



The `eventData` object from the event handler will contain specific information from the `Event` that can be accessed and passed to your Analytics System.

## Steps to define a custom Analytics Collector

The following steps summarise the basic components of an analytics collector. Bitmovin offers open source access to custom collectors created for specific Analytics Systems on the market, we recommend you take a look at the [Github Repository](🔗) for further details of the implementation.

  • **Define your communication model with your Analytics System:** The Metrics and Analytics systems generally have a communication model, that also requires **authentication** and the creation of a **playback session**. Once this model is clear, it can be implemented in the application that handles the Bitmovin Player. The following code example shows a custom collector definition:


  • **Define the required Events, and provide the specific data:** every metrics system would require specific data about the playback or the content in general, please be sure to identify the proper events needed from Bitmovin’s documentation.



## Conclusion

Implementing a custom collector for your Metrics and Analytics System should be fairly simple with the Events API of the Bitmovin Player SDKs. It is important to understand the communication model between client/server of your Metrics Analytics System, so the authentication and data reporting is handled properly inside the event handlers. The even handlers provide all the data needed from the event, by accessing the `Event` object