> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/additional-measurements-with-the-analytics-scripts.md).

# Additional measurements with analytics scripts

Learn how to enhance your website's analytics by adding the Umbraco Engage JavaScript file.

You can add the Umbraco Engage Analytics JavaScript file to your website by placing this code before the closing `</body>` tag of your website.

```html
<script src="/Assets/Umbraco.Engage/Scripts/umbracoEngage.analytics.js"></script>
```

{% hint style="info" %}
Includes support for "async" and "defer" keywords.
{% endhint %}

When this file is included, Umbraco Engage sends the following data to the server before the visitor navigates to another page:

* **Scroll Depth**: Tracks the maximum scroll depth in both pixels and percentage of the page. For example, a user might scroll to 93% of the page height, which could equal 967 pixels.
* **Total Time on Page**: The total time on page is measured in milliseconds. It is defined as the time difference between the page load and the moment the user leaves the page.
* **Engaged Time on Page**: This measures the time the user is active on the page and in our opinion is more accurate than the total time on page. This script measures only the time when you are scrolling or clicking on the page in the active tab. It excludes idle time, such as when you are getting coffee or working in another tab. A 5-second grace period is used to define engagement. For more information, see [this blogpost](https://www.simoahava.com/analytics/track-content-engagement-via-gtm/).
* **Clicks Tracked**: All clicks to the following URLs are measured:
  * External domains
  * .pdf, .doc, or .docx document
  * An internal onpage link which is defined by an anchor link (#intro)
  * `mailto:` and `tel:` links

{% hint style="info" %}
If the filename remains unchanged, this file will be overwritten each time you update the Umbraco Engage to a newer version.
{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/additional-measurements-with-the-analytics-scripts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
