---
title: Web analytics API
related:
  - https://docs.kentico.com/k9/on-line-marketing-features/web-analytics.md
  - https://docs.kentico.com/k9/custom-development/database-table-api.md
  - https://docs.kentico.com/k9/custom-development/miscellaneous-custom-development-tasks/web-analytics-api/adding-custom-web-analytics.md
  - https://docs.kentico.com/k9/custom-development/miscellaneous-custom-development-tasks/web-analytics-api/logging-conversions-through-the-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 _Top exit pages_ statistic. The latest candidate recorded for a visitor when their session expires is then stored as the final exit page.

![Image2013 3 4101857](https://docs.kentico.com/docsassets/k9/web-analytics-api/image2013-3-4101857.png)

### Campaign and conversion statistic storage

The following tables store [campaign](https://docs.kentico.com/k9/on-line-marketing-features/web-analytics/tracking-campaigns.md) and [conversion](https://docs.kentico.com/k9/on-line-marketing-features/web-analytics/logging-conversions-on-your-website.md) tracking objects:

| Database table                | Description                                                                                                                                                                                                                                                       |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Analytics\_Campaign           | Contains records representing campaigns and their settings.                                                                                                                                                                                                       |
| Analytics\_Conversion         | Contains records representing conversions.                                                                                                                                                                                                                        |
| Analytics\_ConversionCampaign | Stores relationships between campaigns and conversions.<br>Each entry in this table indicates that a conversion is included in the statistics of a certain campaign. Only campaigns that are restricted to a limited set of conversions have these relationships. |

The data logged for campaigns and conversions is stored like all other web analytics statistics. The main records are kept in the **Analytics\_Statistics** table and the corresponding amount of hits for individual units of time are saved in the appropriate **Hits** table.

Page view statistics for campaigns always use the _campaign_ **StatisticsCode** with the name of the given campaign stored in the **StatisticsObjectName** column.

The following code names are used for conversion statistics:

- **conversion** - general statistic used to store the overall conversion records. This statistic is always logged when a conversion is performed on the website.
- **campconversion;\<campaign name>** - logged when a conversion is performed by a user associated with the particular campaign.
- **abconversion;\<A/B test code name>;\<Variant code name>** - logged when a conversion is performed by a user who viewed the given page variant of an [A/B test](https://docs.kentico.com/k9/on-line-marketing-features/optimization-testing/a-b-testing-website-pages.md).
- **mvtconversion;\<MVT test code name>;\<Combination name>** - logged when a conversion is performed by a user who viewed the given content combination on a page with a defined [multivariate test](https://docs.kentico.com/k9/on-line-marketing-features/optimization-testing/multivariate-testing.md).

All types of conversions use the **StatisticsObjectName** column to store the code name of the logged conversion.

## API classes

You can find all web analytics classes under the **CMS.WebAnalytics** namespace.

| Class                                         | Description                                                                                                                          |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **Analytics\_Statistics table API**           |                                                                                                                                      |
| StatisticsInfo                                | Represents the statistics of a certain event within a specific context.                                                              |
| StatisticsInfoProvider                        | Provides management functionality for statistic records.                                                                             |
| **Analytics\_\<time interval>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\_Conversion table API**           |                                                                                                                                      |
| ConversionInfo                                | Represents conversion tracking objects.                                                                                              |
| ConversionInfoProvider                        | Provides management functionality for conversions.                                                                                   |
| **Analytics\_ConversionCampaign table API**   |                                                                                                                                      |
| ConversionCampaignInfo                        | Represents relationships between campaigns and conversions.                                                                          |
| ConversionCampaignInfoProvider                | Provides management functionality for campaign‑conversion relationships.                                                             |
| **Other classes**                             |                                                                                                                                      |
| AnalyticsHelper                               | Provides general web analytics functionality and data.                                                                               |
| HitLogProvider                                | Contains methods used to create the analytics log files for statistics.                                                              |
| HitLogProcessor                               | This class defines the scheduled task that periodically processes analytics log files and transfers the information to the database. |
