> For the complete documentation index, see [llms.txt](https://docs.imqa.io/imqa-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imqa.io/imqa-guide/eng/installation-guide/web-wpm/webagent-installation.md).

# WebAgent Installation

{% hint style="warning" %}
This document provides instructions for applying IMQA WebAgent in different browser environments.
{% endhint %}

You can install IMQA WebAgent in two ways: you can connect to the CDN server, or if you use the install wizard or do not have access to CDN, you can download the corresponding script. Right-click the link below and select “Save As”: <https://imqawebviewagent.blob.core.windows.net/agent/web-agent.js>

###

## 1. WPM Alone (WebAgent Installation)

This is how to install the Agent for web performance analytics in a web browser application configuration using only the WPM service.

#### Fetching from a CDN server

IMQA WebAgent requires inserting the script into the top of your html in the \<head>.

{% code title="html <head> to connect to web-agent.js" %}

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

// IMQA web-agent Required script values
<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", "User project key");

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

```

{% endcode %}

#### Install locally

{% code title="html <head> to connect to web-agent.js" %}

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

// IMQA web-agent Required script values
<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", "User project key");

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

```

{% endcode %}

## 2. Both WPM/MPM (WebAgent + WebViewAgent Installation)

This is how to install the Agent for WebView/web performance analytics in mobile and web browser application configurations using both WPM and MPM services.

#### Fetching from a CDN server

IMQA WebAgent requires inserting the script into the top of your html in the \<head>.

{% code title="html <head> to connect to web-agent.js" %}

```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 Required script values
<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", "User 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 %}

#### Install locally

If you use install wizard or you do not have access to CDN, you can download the corresponding script. Right-click [this link](https://imqawebviewagent.blob.core.windows.net/agent/web-agent.js) below and select “Save As”:

{% code title="html <head> to connect to web-agent.js" %}

```html
// Connect IMQA web-agent.js received locally
<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 Required script values
<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", "User 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
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.imqa.io/imqa-guide/eng/installation-guide/web-wpm/webagent-installation.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.
