## Recording Custom Events

To record custom events call the `record` method:

```javascript
Analytics.record({ name: 'albumVisit' });
```

## Record a Custom Event with Attributes

The `record` method lets you add additional attributes to an event. For example, to record _artist_ information with an _albumVisit_ event:

```javascript
Analytics.record({
  name: 'albumVisit',
  // Attribute values must be strings
  attributes: { genre: '', artist: '' }
});
```

## Record Engagement Metrics

Data can also be added to an event:

```javascript
Analytics.record({
  name: 'albumVisit',
  attributes: {},
  metrics: { minutesListened: 30 }
});
```

Metric values must be a `Number` type such as a float or integer.

## Record Events Immediately

The Amazon Pinpoint & Kinesis providers send events in batches to optimize network bandwidth. However, events can be sent immediately using the `immediate` flag.

```javascript
Analytics.record({
  name: 'albumVisit',
  immediate: true
});
```
