# Agama on Web

Agama is an analytics solution maintained by [Agama Technologies](https://www.agama.tv/). THEOplayer offers a pre-integration for this service.

## Prerequisites

Agama requires you to load the Agama library and configure it through JavaScript. Agama needs to be configured through the player configuration and through the source configuration. The following section describes how this can be done.

## Configuration

The player configuration should include the [AgamaPlayerConfiguration](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/web/interfaces/AgamaPlayerConfiguration) object.

```js
var player = new THEOplayer.Player(element, {
  libraryLocation: '/path/to/your-theoplayer-folder/',
  analytics: [
    {
      integration: 'agama',
      config: 'emp_service=http://127.0.0.1:8191/report;report_interval=60;id_report_interval=240;operator_id=fooSoo',
    },
  ],
});
```

Once a player is configured, an Agama EMP client instance is created.

The player's source configuration should include the [AgamaSourceConfiguration](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/web/interfaces/AgamaSourceConfiguration) object.

```js
player.source = {
    [...]
    analytics : [{
        integration : 'agama',
        asset : 'Asset Name',
        streamType : 'vod'
    }]
};
```

Once the player's source is set, a dynamic streaming session is started, and Agama EMP is ready to monitor the usage and quality of the video.

## Related resources

* [Custom Analytics Integration](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/how-to-guides/web/analytics/custom-analytics-integration.md)
