---
title: Debugging web analytics
related:
  - https://docs.kentico.com/k81/on-line-marketing-features/web-analytics/enabling-web-analytics.md
  - https://docs.kentico.com/k81/custom-development/miscellaneous-custom-development-tasks/web-analytics-api/adding-custom-web-analytics.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you encounter problems or unexpected behavior related to [web analytics](https://docs.kentico.com/k81/on-line-marketing-features/web-analytics.md) (for example with [custom statistics](https://docs.kentico.com/k81/custom-development/miscellaneous-custom-development-tasks/web-analytics-api/adding-custom-web-analytics.md)), you can use the system's debugging functionality to monitor how the analytics log statistics for individual web requests.

## Enabling the web analytics debug

To use web analytics debugging, open the **Settings** application and adjust the settings in the **System -> Debug** category:

| Setting                                  | Description                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enable web analytics debug               | Enables web analytics debugging and the **Analytics** tab in the interface of the **Debug** application.                                                                                                                                                                                                                                                  |
| Display web analytics debug on live site | If enabled, web analytics debug information is also displayed at the bottom of each page on the live site. Requires web analytics debugging to be enabled.<br>Debugging on the live site is only available if your site does NOT use JavaScript logging for web analytics (**On-line marketing -> Web analytics -> Log via JavaScript snippet** setting). |
| Web analytics debug log length           | Sets the maximum length of the web analytics debug log, i.e. the number of requests for which debug information is preserved and displayed.<br>If empty, value of the **Default log length** setting is used.                                                                                                                                             |
| Display stack information                | If enabled, the system tracks the code stack when debugging web analytics and displays the information in the **Context** column.<br>This information is only available in the debugging UI and on the live site, not in the debug log written into the _loganalytics.log_ file.                                                                          |
| Log web analytics to file                | If enabled, the system saves the web analytics debug log into the _loganalytics.log_ file in the _\~\App\_Data_ folder. This option does not require web analytics debugging to be enabled.                                                                                                                                                               |

> **Tip:** **Tip**: You can also enable web analytics debugging through the "debug everything" settings in the **All** section of the **Debug** settings category.

## Monitoring web analytics logging

To view which statistics the web analytics logged for recent web requests:

1. Open the **Debug** application.
2. Select the **Analytics** tab.

You can see the URLs of web requests and the time when the system processed the requests. The table below each request contains the web analytics statistics that the system logged for the given request. The table provides the following information for each statistic:

- The **Code name** of the statistic
- The **Object** related to the event (for example when logging page views, the Object value contains the alias path and page ID of the viewed page)
- The number of hits that occurred (**Count**)
- The code name of the site where the event occurred
- The **Context** in which the system logged the event (API method)

  - Click on the method to see the full stack trace.
  - If you enable the **Show complete context** option at the top of the interface, the stack trace is displayed for all statistics.

Click **Clear debug log** to remove all records in the web analytics debug.
