> For the complete documentation index, see [llms.txt](https://docs.wicle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wicle.io/action/experiment/events.md).

# 計測されるイベント

A/Bテストの施策がサイト上で配信されると、計測タグが施策専用のイベントを自動送信します。配信UU・操作内訳・エラー件数などの効果測定は、これらのイベントをもとに集計されます。

{% hint style="info" %}
これらのイベントは**計測イベント数の実績としてカウントされない**非課金イベントです。一般の自動計測イベントについては [自動計測されるイベント](/data-setting/event-tracking/auto-event.md) をご覧ください。
{% endhint %}

## イベント一覧 <a href="#event-list" id="event-list"></a>

| イベント名                    | 発火タイミング                      |
| ------------------------ | ---------------------------- |
| `experiment_impression`  | バリアントが割り当てられ、表示が確定したとき       |
| `experiment_interaction` | トリートメント上でクリックまたはクローズが計測されたとき |
| `experiment_error`       | 施策コードやPlanの適用に失敗したとき         |

## 表示（experiment\_impression） <a href="#impression" id="impression"></a>

施策の表示（インプレッション）を表すイベントです。配信UUの集計に使われます。

### 発火条件 <a href="#impression-when" id="impression-when"></a>

URL条件・ディメンション条件・デバイス・フリークエンシーを通過し、バリアントが割り当てられたあとに送信されます。コントロールとトリートメントで送信タイミングが異なります。

| バリアント                | 送信タイミング                              |
| -------------------- | ------------------------------------ |
| コントロール               | 割当直後に送信します（コードは実行しません）               |
| トリートメント（Plan）        | Planの適用が成功したとき（`when` 条件未達の間は送信しません） |
| トリートメント（JSあり）        | スクリプトの読み込み完了（onload）後                |
| トリートメント（CSSのみ）       | CSS適用直後                              |
| トリートメント（HTMLのみ・JSなし） | 送信しません。代わりにエラーイベントを送信します             |

### 重複制御 <a href="#impression-dedupe" id="impression-dedupe"></a>

同一セッション内では、施策（`experiment_id`）ごとに**1回のみ**送信します。

### プロパティ <a href="#impression-props" id="impression-props"></a>

| プロパティ           | 型   | 説明                |
| --------------- | --- | ----------------- |
| `experiment_id` | 文字列 | 施策ID              |
| `variant_id`    | 文字列 | 割り当てられたバリアントID    |
| `is_control`    | 真偽値 | コントロールの場合は `true` |
| `pageTitle`     | 文字列 | ページタイトル（共通付与）     |
| `uri.url`       | 文字列 | ページURL（共通付与）      |

## 操作（experiment\_interaction） <a href="#interaction" id="interaction"></a>

施策上のクリックやクローズを表すイベントです。効果測定の操作内訳に使われます。

### 発火条件 <a href="#interaction-when" id="interaction-when"></a>

* **コントロールでは送信しません**
* 操作種別は `click` と `close` のみです
* 配信設定の計測ターゲット（`trackingTargets`）に含まれ、かつ計測がONの要素だけが対象です

#### クリック（click）

次の両方を満たす要素がクリックされたときに送信されます。

* 要素に `data-wcl-track="{ターゲットID}"` が付いている
* 祖先（またはShadow DOMのホスト）に `data-wcl-experiment="{施策ID}"` が付いている
* 計測ターゲットに、同じIDで `type: click` が定義されている

施策ツリー全体のクリックを自動計測するわけではなく、マークされた要素のみが対象です。

#### クローズ（close）

施策コードから次のAPIを呼び出したときに送信されます。

```javascript
window.wclExperiment.interaction(experimentId, 'close', targetId);
```

* `targetId` を指定した場合、計測ターゲットに同じIDの `type: close` があるときだけ計測されます
* `targetId` を省略した場合、クローズ用ターゲットが1件だけなら、そのターゲットに紐付けて計測されます（0件または複数件のときは計測されません）

### 重複制御 <a href="#interaction-dedupe" id="interaction-dedupe"></a>

同一セッション内では、次の組み合わせごとに**1回のみ**送信します。

* 施策ID
* バリアントID
* 操作種別（`click` / `close`）
* ターゲットID

### プロパティ <a href="#interaction-props" id="interaction-props"></a>

| プロパティ              | 型   | 説明                          |
| ------------------ | --- | --------------------------- |
| `experiment_id`    | 文字列 | 施策ID                        |
| `variant_id`       | 文字列 | バリアントID                     |
| `is_control`       | 真偽値 | 常に `false`（コントロールは送信されないため） |
| `interaction_type` | 文字列 | `click` または `close`         |
| `target_id`        | 文字列 | 計測ターゲットのID                  |
| `target_label`     | 文字列 | 計測ターゲットの表示名                 |
| `pageTitle`        | 文字列 | ページタイトル（共通付与）               |
| `uri.url`          | 文字列 | ページURL（共通付与）                |

{% hint style="info" %}
計測ターゲットのON/OFFや表示名の設定方法は [施策を作成する](/action/experiment/create.md#tracking-target) をご覧ください。自分で実装する場合の契約は [自分で実装する](/action/experiment/create/diy-coding.md) も参照してください。
{% endhint %}

## エラー（experiment\_error） <a href="#error" id="error"></a>

施策の適用に失敗したときに送信されるイベントです。一覧画面や配信状況のエラー表示に使われます。

### 主な発火例 <a href="#error-when" id="error-when"></a>

| メッセージ例                                      | 状況                               |
| ------------------------------------------- | -------------------------------- |
| `Script load failed`                        | 施策JSの読み込みに失敗した                   |
| `Script load timeout`                       | 施策JSの読み込みがタイムアウトした（約15秒）         |
| `Plan op[n] failed: ...`                    | Planの操作適用に失敗した                   |
| `Treatment html requires codeUrl for mount` | HTMLがあるのにJS（codeUrl）がなく、マウントできない |
| `Variant assignment error: ...`             | バリアント割当処理で例外が発生した                |

### 重複制御 <a href="#error-dedupe" id="error-dedupe"></a>

重複制御はありません。条件を満たすたびに送信されます。

### プロパティ <a href="#error-props" id="error-props"></a>

| プロパティ           | 型   | 説明                           |
| --------------- | --- | ---------------------------- |
| `experiment_id` | 文字列 | 施策ID                         |
| `variant_id`    | 文字列 | バリアントID（割当前の失敗では空になる場合があります） |
| `error_message` | 文字列 | エラー内容                        |
| `pageTitle`     | 文字列 | ページタイトル（共通付与）                |
| `uri.url`       | 文字列 | ページURL（共通付与）                 |

## 共通仕様 <a href="#common" id="common"></a>

### 共通で付与されるプロパティ <a href="#common-props" id="common-props"></a>

上記の専用プロパティに加え、通常の計測イベントと同様にページタイトル・URL・リファラ・デバイス情報などが付与されます。

### プレビューでは送信しない <a href="#preview" id="preview"></a>

サンプルプレビュー・ライブプレビューのプレビューモードでは、施策の評価・配信イベントは送信されません。本番配信（またはChrome拡張での確認）で計測を確認してください。

### イベント別URL条件の対象外 <a href="#url-conditions" id="url-conditions"></a>

計測タグ設定のイベント別URL条件（クリック・スクロールなど）の対象には含まれません。施策の配信URL条件を通過して表示・操作が起きた場合は、タグ側のイベント別URL条件に関係なく送信されます。

### 非課金 <a href="#not-billed" id="not-billed"></a>

`experiment_impression` / `experiment_interaction` / `experiment_error` は、いずれも計測イベント数の課金対象外です。ただし、プロジェクトのイベント数上限に達して計測が停止している間は、これらのイベントも送信されず、A/Bテストの配信も止まります。詳しくは [イベント数上限とA/Bテストの配信](/action/experiment/event-limit.md) をご覧ください。

## コンバージョンとの関係 <a href="#conversion" id="conversion"></a>

コンバージョン測定用の専用イベント（例: `experiment_conversion`）はありません。

配信設定で指定したコンバージョンイベント（カスタムイベント・コードレスイベントなど）が、`experiment_impression` のあとに同一ユーザーで発生したかどうかで効果を判定します。

{% hint style="info" %}
コンバージョンの設定方法は [配信設定](/action/experiment/settings.md) をご覧ください。
{% endhint %}

## 送信イベントの確認方法 <a href="#verify" id="verify"></a>

1. Chrome拡張を開き、計測タグが設置されたサイトで施策を表示します
2. `Events` タブで `experiment_impression` / `experiment_interaction` / `experiment_error` を確認します

{% hint style="info" %}
手順の詳細は [Chrome拡張で動作を確認する](/action/experiment/debug.md) および [送信されるイベントの確認機能](/chrome-extension/event-viewer.md) をご覧ください。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wicle.io/action/experiment/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
