> ## Documentation Index
> Fetch the complete documentation index at: https://docs.struct.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Tag Metrics

> Stream aggregated volume and transaction metrics rolled up by tag.

<Note>
  **Room ID:** `polymarket_tag_metrics` \
  **Endpoint:** `wss://api.struct.to/ws` \
  **Rate:** 0.025 credits per message
</Note>

Stream real-time volume, fee, and activity metrics aggregated by tag, across multiple timeframes. One event is pushed per timeframe window on each update, with a separate breakdown for builder-attributed activity.

## Subscribe

The `tags` filter is required and must be non-empty. Tags are matched case-insensitively against either label or slug.

### Filters

| Filter          | Type       | Required | Description                                                                                                           |
| --------------- | ---------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `tags`          | `string[]` | Yes      | Tag labels or slugs to track                                                                                          |
| `subscribe_all` | `boolean`  | No       | Firehose: receive metrics for every tag. The `tags` filter is ignored when set; the `timeframes` filter still applies |

### Example

```json theme={null}
{
  "type": "join_room",
  "payload": {
    "room_id": "polymarket_tag_metrics"
  }
}
```

```json theme={null}
{
  "type": "room_message",
  "payload": {
    "room_id": "polymarket_tag_metrics",
    "message": {
      "action": "subscribe",
      "tags": ["Politics", "Crypto"]
    }
  }
}
```

### Response

```json theme={null}
{
  "type": "tag_metrics_stream_subscribe_response",
  "room_id": "polymarket_tag_metrics",
  "data": {
    "tags": ["politics", "crypto"],
    "rejected": [],
    "error": null
  }
}
```

## Events

### `tag_metrics_update`

<Info>
  **Volume on Polymarket vs. Struct.** Polymarket's UI reports "volume" as notional (the count of shares or contracts traded), which corresponds to `shares_volume` in Struct payloads. `usd_volume` is the dollar value of those trades. Use `shares_volume` to match figures shown on Polymarket and `usd_volume` for true USD throughput.
</Info>

Emitted once per timeframe window each time the underlying tag metrics change. Timeframe values: `1m`, `5m`, `30m`, `1h`, `6h`, `24h`, `7d`, `30d`.

```json theme={null}
{
  "type": "tag_metrics_update",
  "room_id": "polymarket_tag_metrics",
  "data": {
    "tag": "politics",
    "timeframe": "1h",
    "timestamp": 1743500000,
    "usd_volume": "120000.00",
    "shares_volume": "148000.00",
    "builder_usd_volume": "30000.00",
    "builder_shares_volume": "37000.00",
    "fees": 600.0,
    "builder_fees": 150.0,
    "txns": 740,
    "builder_txns": 185,
    "unique_traders": 210,
    "unique_builder_traders": 54
  }
}
```

USD and shares volumes are decimal strings to preserve precision. Builder-attributed fields cover the subset of activity routed through builder-signed orders.
