# \[共通] WebAgentのインストール

{% hint style="warning" %}
この文書は、Browser環境でのIMQA Web Agentを適用する方法を提供します。
{% endhint %}

IMQA Web Agentは2つの方法でインストール方法を提供しています。 CDNサーバーに接続したり、設置型またはCDNでリクエストできない場合は、該当スクリプトをダウンロードして使用できます。 以下のリンクを通して右クリックし、"名前を付けて保存"をクリックして接続してください。 <https://imqawebviewagent.blob.core.windows.net/agent/web-agent.js>

## 1. WPM単独使用 (WebAgentインストール)

WPMサービスのみを利用し、Webブラウザアプリケーション構成でのウェブ性能分析のためのAgentインストール方法です。

### CDNサーバから受信

IMQA Web Agentはスクリプトをhtmlの内部の最上段に挿入してください。

{% code title="Web-agent.jsをリンクする html <head>" %}

```html
// Connect IMQA web-agent.js
<script src="https://cdn.imqa.io/agent/web-agent-1.1.11.js"></script>

// IMQA web-agent script required value
<script>
((w, c, _wv, _w, _wk, _mh, _b) => {
    w[c] = w[c] || {};
    function imqaConf(key, value){w[c][key]=value};

    imqaConf("imqaAgentUse", true);
    imqaConf("projectKey", "PROJECT_KEY");

    w[_w](w);
})(window, 'imqaClientConfig', 'IMQAWebviewMain', 'IMQAWebMain', 'webkit', 'messageHandlers', 'ImqaBridge')
</script>

```

{% endcode %}

### ローカルインストール

{% code title="Web-agent.jsをリンクする html <head>" %}

```html
// Connect IMQA web-agent.js
<script src="user path/web-agent-1.1.11.js"></script>

// IMQA web-agent script required value
<script>
((w, c, _wv, _w, _wk, _mh, _b) => {
    w[c] = w[c] || {};
    function imqaConf(key, value){w[c][key]=value};

    imqaConf("imqaAgentUse", true);
    imqaConf("projectKey", "PROJECT_KEY");

    w[_w](w);
})(window, 'imqaClientConfig', 'IMQAWebviewMain', 'IMQAWebMain', 'webkit', 'messageHandlers', 'ImqaBridge')
</script>

```

{% endcode %}

## 2. WPM / MPM 統合使用 (WebAgent+WebviewAgentインストール)

WPMとMPMサービスを利用し、モバイルとWebブラウザアプリケーション構成でのWebView/Web性能分析のためのAgentインストール方法です

### CDNサーバから受信

IMQA Web Agentはスクリプトをhtmlの内部の最上段に挿入してください。

{% code title="Web-agent.jsをリンクする html <head>" %}

```html
// Connect IMQA web-agent.js
<script src="https://cdn.imqa.io/agent/web-agent-1.1.11.js"></script>
<script src="https://cdn.imqa.io/agent/webview-agent-1.1.3.js"></script>

// IMQA web-agent script required value
<script>
((w, c, _wv, _w, _wk, _mh, _b) => {
    w[c] = w[c] || {};
    function imqaConf(key, value){w[c][key]=value};

    imqaConf("imqaAgentUse", true);
    imqaConf("projectKey", "PROJECT_KEY");
    if ((w[_wk] !== undefined && w[_wk][_mh] !== undefined) || w[_b] !== undefined)
      w[_wv](w);
    else w[_w](w);
})(window, 'imqaClientConfig', 'IMQAWebviewMain', 'IMQAWebMain', 'webkit', 'messageHandlers', 'ImqaBridge')
</script>

```

{% endcode %}

### ローカルインストール&#x20;

設置型またはCDNでリクエストできない場合は、該当スクリプトをダウンロードして使用できます。 [このリンク](https://imqawebviewagent.blob.core.windows.net/agent/web-agent.js)を通して右クリックし、"名前を付けて保存"をクリックして接続してください。

{% code title="Web-agent.jsをリンクする html <head>" %}

```html
// Connect IMQA web-agent.js
<script src="user path/web-agent-1.1.11.js"></script>
<script src="user path/webview-agent-1.1.3.js"></script>

// IMQA web-agent script required value
<script>
((w, c, _wv, _w, _wk, _mh, _b) => {
    w[c] = w[c] || {};
    function imqaConf(key, value){w[c][key]=value};

    imqaConf("imqaAgentUse", true);
    imqaConf("projectKey", "PROJECT_KEY");
    if ((w[_wk] !== undefined && w[_wk][_mh] !== undefined) || w[_b] !== undefined)
      w[_wv](w);
    else w[_w](w);
})(window, 'imqaClientConfig', 'IMQAWebviewMain', 'IMQAWebMain', 'webkit', 'messageHandlers', 'ImqaBridge')
</script>
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://docs.imqa.io/imqa-guide/jpn/installation/web-wpm-wcrash/webagentnoinsutru.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
