open-index/open-npm huggingface dataset:
npm package: @kiina/bot-analytics
Description: This package contains the BotAnalytics class, which is used to track the Bot communication data in a 3rd-party tracking platform.
Author: Fred Souza
Latest version: 1.1.0

# Bot Analytics

This package contains the BotAnalytics class, which is used to track the Bot communication data in a 3rd-party tracking platform.

## Installation

```
npm install @kiina/bot-analytics
```

## Usage

```javascript
const BotAnalytics = require('@kiina/bot-analytics');

BotAnalytics.API_KEY = '<my-api-key>';

const analytics = new BotAnalytics('1.0.0');
const tracker = analytics.newTrackingContext()
  .setType(Analytics.MessageType.AGENT)
  .setPlatform(Analytics.Platform.FACEBOOK)
  .setUserId('user-id')
  .setMessage('hello world!')
  .setTimestamp(123456)
  .setIntent('intent-name') // not implemented yet
  .setMessageHandled() // Optional: call it only if the message was handled by the bot (no overflow)
  .setSessionId('session-id');

analytics.trackMessage(tracker);
```