---
title: Analytics Engine
description: "Write event data points with env.NAME.writeDataPoint and read the latest back."
---

## Configuration

```jsonc
"analytics_engine_datasets": ["EVENTS"]
```

A dataset takes a bare name only. It has no id and needs no provisioning: it exists from its first `writeDataPoint`.

## Usage

```js
env.EVENTS.writeDataPoint({ indexes: ["signup"], blobs: [country], doubles: [1] });
const { count, rows } = env.EVENTS.query({ limit: 50 });
// rows: [{ timestamp, indexes, blobs, doubles }], newest first
```

## Methods

| Method | Signature | Returns |
| --- | --- | --- |
| `writeDataPoint` | `({ indexes?, blobs?, doubles? })` | `void` |
| `query` | `({ limit? })` | `{ count, rows }`: the total number of data points, and the newest `limit` of them (default 20, at most 200). |
