---
title: Web analytics API
related:
  - https://docs.kentico.com/13/on-line-marketing-features/managing-your-on-line-marketing-features/web-analytics.md
  - https://docs.kentico.com/13/on-line-marketing-features/managing-your-on-line-marketing-features/campaigns.md
  - https://docs.kentico.com/13/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-web-analytics/adding-custom-web-analytics.md
  - https://docs.kentico.com/13/configuring-xperience/data-protection/gdpr-compliance/logging-web-analytics-based-on-consent.md
  - https://docs.kentico.com/13/custom-development/database-table-api.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).

## Database tables

Web analytics use six primary database tables to store statistics and their values.

The **Analytics\_Statistics** table stores records that represent the statistics of a tracked event within a certain context, i.e. related to a specific object, site and culture.

Five other tables are used to store the exact number of hits for the statistics in the _Analytics\_Statistics_ table:

- **Analytics\_HourHits**
- **Analytics\_DayHits**
- **Analytics\_WeekHits**
- **Analytics\_MonthHits**
- **Analytics\_YearHits**

When a hit for a tracked statistic occurs, it is logged into all of these tables. The difference between them is in the unit of time used to separate hits into individual records. For example, a record in the **Analytics\_HoursHits** table contains the number of hits that were logged for a given statistic during one hour, while a single record in **Analytics\_MonthHits** counts all hits that occurred over an entire month.

The **Analytics\_ExitPages** table is used to temporarily store exit page candidates for the _Exit pages_ statistic. Exit page candidates are updated as visitors browse pages on the website (bound to individual users through a cookie). After an exit page candidate remains unchanged for 20 minutes, it is stored as an exit page.

![](https://docs.kentico.com/docsassets/13/web-analytics-api/Web_Analytics_DB_Diagram.png)

### Campaign statistic storage

The following tables store [campaign](https://docs.kentico.com/13/on-line-marketing-features/managing-your-on-line-marketing-features/campaigns.md) tracking objects:

| Database table                | Description                                                                      |
| ----------------------------- | -------------------------------------------------------------------------------- |
| Analytics\_Campaign           | Contains records representing campaigns and their settings.                      |
| Analytics\_CampaignAsset      | Stores relationships between campaigns and their assets specified by their GUID. |
| Analytics\_CampaignAssetUrl   | Stores relationships between campaigns and page assets specified by their GUID.  |
| Analytics\_CampaignConversion | Contains records representing campaign conversions.                              |

## API classes

You can find the web analytics API classes and services under the **CMS.WebAnalytics** namespace.

| Class                                       | Description                                                                                                                    |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Analytics logging service**               |                                                                                                                                |
| IAnalyticsLogger                            | Service that allows logging of web analytics hits. We recommend obtaining instances of the service using dependency injection. |
| **Analytics\_Statistics table API**         |                                                                                                                                |
| StatisticsInfo                              | Represents the statistics of a certain event within a specific context.                                                        |
| StatisticsInfoProvider                      | Provides management functionality for statistic records.                                                                       |
| **Analytics\_Hits table API**               |                                                                                                                                |
| HitsInfo                                    | Represents the hits of statistics during a specific time interval.                                                             |
| HitsInfoProvider                            | Provides management functionality for statistic hits.                                                                          |
| **Analytics\_Campaign table API**           |                                                                                                                                |
| CampaignInfo                                | Represents campaign tracking objects.                                                                                          |
| CampaignInfoProvider                        | Provides management functionality for campaigns.                                                                               |
| **Analytics\_CampaignAsset table API**      |                                                                                                                                |
| CampaignAssetInfo                           | Represents the relationships between campaigns and their assets.                                                               |
| CampaignAssetInfoProvider                   | Provides management functionality for the relationships.                                                                       |
| **Analytics\_CampaignAssetUrl table API**   |                                                                                                                                |
| CampaignAssetUrlInfo                        | Represents the relationships between campaigns and their page assets.                                                          |
| CampaignAssetUrlInfoProvider                | Provides management functionality for the relationships.                                                                       |
| CampaignAssetUrlInfoHelper                  | Provides functionality for input validation.                                                                                   |
| **Analytics\_CampaignConversion table API** |                                                                                                                                |
| CampaignConversionInfo                      | Represents conversion tracking objects of campaigns.                                                                           |
| CampaignConversionInfoProvider              | Provides management functionality for campaign conversions.                                                                    |
