---
title: Consumption metrics
slug: dxp/docs/consumption-metrics
docTags: 
createdAt: 2026-07-30T20:33:07.587Z
---

Setting the usage parameters correctly, especially for single-page applications, ensures the website traffic volume monitoring is correct.

You define the consumption levels when setting service tiers based on the estimated amount of generated traffic. The usage parameters measure the service consumption.

An example of a usage parameter is the view of a page on a customer website provided by a service instance under an Optimizely DXP subscription. A visitor clicking reload after reaching the page counts as an additional page view. A visitor going to a different page and returning to the original page records an additional page view.

You can see the consumption metrics and traffic volumes in [Application Insight](docId:_l5t4yNuSDxBTyWhCUKQF) (requires access).

## Usage parameter definitions

- **Page view** – Tracks page impressions. Every occurrence where a *page* is displayed to a visitor counts as a page view. For websites, page views usually correlate with *events* where the browser location changes, such as when a visitor clicks a link, navigates browser history, and reloads the current page or types in a new address.

:::hint{type="info"}
**Note**
Bot traffic, that is not blocked by default Cloudflare WAF rules, is counted as a billable page view.
:::

- **Page** – Compiles content that is *not a static file* but has a URL and can be loaded in a browser. Depending on the implementation, a page may map to an instance of a page type in Optimizely Content Management System (CMS) or to a product in Optimizely Customized Commerce. Still, it may also include blocks, external data, or aggregates of external data or other pages.
- **Static file** – Contains an uploaded or deployed file, such as a PDF, image, or CSS with a URL, and can be downloaded as-is by visitors.
- **Visits** – Tracks site entry requests for frontend hosting solutions. Optimizely uses Cloudflare Zone Analytics to calculate visits. A visit is an HTTP request that returns an HTML response where the `Referer` header either is absent (for example, a direct URL, bookmark, or typed address) or does not match the site hostname (for example, a link from a search engine or another website). Visits do not include traffic blocked by the Web Application Firewall (WAF), and visits are measured at the CDN edge, not through browser scripts or cookies. One visit can include multiple page views within the same session.

:::hint{type="info"}
**Note**
**Visits** applies to frontend hosting only. It is a separate metric from **Page view**, which is sourced from Application Insights.
:::

These parameters are the base of the usage metrics. Application Insight monitoring is configured automatically for sites running in DXP, but you may need further configuration to use its features fully, depending on the site architecture.

### How visits are calculated

Cloudflare processes each incoming HTTP request at the edge before forwarding it to the origin server. For each request, Cloudflare records metadata including the IP address, requested URL, user agent, timestamp, and HTTP response status.
A request qualifies as the start of a visit when both of the following are true:

- The response is an HTML page, not a static asset such as an image, stylesheet, or script.
- The `Referer` header is absent or does not match the site hostname.

Cloudflare then groups subsequent requests from the same visitor into a single visit using heuristics based on IP address, user agent, and activity within a defined time window.

The following actions count as a visit:

- A user follows a link from a search engine.
- A user follows a link from another website.
- A user opens a bookmark.
- A user types the URL directly into the browser.

The following actions do not start a new visit:

- Navigating between pages within the same site.
- Refreshing a page (counted within the existing visit).

## Single-page applications

Page views are tracked by default when a new page loads into the browser. Websites based on the Single Page Application (SPA) concept are different because these interact with visitors by dynamically rewriting the current page and do not need page reloading. You need to configure the page view tracking for these websites.

Application Insights is already loaded when the page loads with the following code to track a custom page view:

```javascript
if (typeof appInsights !== 'undefined')
  {
    appInsights.trackPageView(myPageName);
  }
```

### External frontend applications

If you are hosting your frontend application outside DXP Cloud Services, you can instrument and send client telemetry to Application Insights in DXP Cloud Services.

Fetch the Instrumentation Key from the landing page in Application Insights in the Azure Portal.

![Fetch the Instrumentation Key from the landing page in Application Insights in the Azure Portal](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/R4nrsE4kAs-e7Um26j9Ad-20260722-203653.png)

[Follow the steps from Microsoft Azure](https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-sdk?tabs=sdkloaderscript#custom-page-counts) to enable Application Insights.

## Client telemetry

Application Insights tracks server telemetry through a JavaScript agent installed on the server but can also track client telemetry such as page views, session information, and general information about users. This is done through a [JavaScript beacon](https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript?tabs=snippet) injected on the site. This injection happens automatically on App Services for CMS 11 through the app setting `APPINSIGHTS_JAVASCRIPT_ENABLED` or through the NuGet package [EPiServer.CloudPlatform.Cms](https://nuget.optimizely.com/package/?id=EPiServer.CloudPlatform.Cms) on CMS 12. This sends the client telemetry to Application Insights and is retained for 90 days. Optimizely collects the page view data from each application insight instance in DXP and presents it through `https://dxc.episerver.net/`.

:::hint{type="info"}
**Note**
How CMS 12 sites get the Application Insights script depends on the `EPiServer.CloudPlatform.Cms` version and how the site renders pages:

- **1.8.0 and later** – CMS adds the script to the `<head>` element of CMS content pages rendered with Razor views.
- **Earlier versions** – Add the `@Html.RequiredClientResources("Header")` snippet to your site template. Otherwise, CMS does not add the script, and Application Insights does not track page views.
- **Other pages** – Add the Application Insights JavaScript SDK script manually. Follow [Microsoft's guide](https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-sdk#add-the-code-snippet), and use the instrumentation key from the `APPINSIGHTS_INSTRUMENTATIONKEY` environment variable.
:::

You can see this JavaScript in dev tools as `ai.\*.min.js`, depending on your current Application Insights SDK or injected by Microsoft into your web app. You also see a POST request called **Track** that sends the data to application insights at the address `https://dc.services.visualstudio.com/v2/track`.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/eTx8BySXLrIDNa1j_aA81_9c80698-image2022-5-16-9-21-10.png)

To contextualize the user, it injects two cookies called **ai\_session** and **ai\_user** and passes these values to Application Insights in the POST request.

![it injects two cookies called ai\_session and ai\_user and passes these values to application insights in the POST request](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/tfhyBULFh_RYzhniE8nof-20260722-203653.png "image2022-5-16_9-27-39.png")

There is an application-wide option to turn off those cookies:

```csharp
public void ConfigureServices(IServiceCollection services) {
    // services.AddCmsCloudPlatformSupport(_configuration);
    services.Configure<InstrumentationOptions>(o => o.DisableCookieUsage = true);
}
```

Or through `appsettings.json`

```json
{  
  "EPiServer": {  
    "Cms": {  
      "Instrumentation": {  
        "DisableCookieUsage": true  
      }  
    }  
}
```

Turning off the cookies causes some user tracking in Application Insights to stop working but does not affect Page View Tracking.

You can interact with this data in a few ways when the client telemetry is sent to Application Insight.

### 1. Performance Overview

The **Performance Overview** in Application Insight defaults to server telemetry and operations. Still, you can switch it to client telemetry for an overview of browser performance by selecting **Browser** rather than **Server**.

![Performance Overview in Application Insight](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/L5k42fKbT91OsjHV3wXcS-20260722-203653.png "image2022-5-16_9-35-47.png")

### 2. Usage statistics

The **Usage** section in Application Insights gives you an overview of aggregated data such as users, sessions, page views, and custom events over some time.

![Usage section in Application Insights](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/6Pehx101S5gUgku8PwLco-20260722-203653.png "image2022-5-16_9-43-18.png")

### 3. Workbooks

**Workbooks** are customizable reports to make analytics easier and more understandable. Workbooks can be based on any data in Application Insights with pre-built ones on client telemetry and usage.

![Workbooks in Application Insights](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/CufHatk_oGE9l5YYSWuWd-20260722-203653.png "image2022-5-16_9-46-27.png")

### 4. Log analytics

Most of the data visible in Application Insights is available as tables through the **Logs** section. This is the most flexible and complex way to interact with the client telemetry. Most client telemetry is available in the table called **pageViews and browserTimings**.

### Example queries

1. View page views for the last 30 days.

```text
pageViews
| where timestamp > ago(30d)
| summarize count() by bin(timestamp, 1d)
| render timechart
```

2. Count of unique users.

```text
pageViews
| where timestamp > ago(30d)
| summarize dcount(user_Id)
```

3. Page views by site.

```text
pageViews
| where timestamp > ago(30d)
| extend site = split(url, "/")[2]
| summarize count() by tostring(site)
```

See also [Microsoft Documentation](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-javascript#custom-page-counts).

### 5. Disable unload event

Chrome has deprecated the `unload` event (see [Deprecating the unload event](https://developer.chrome.com/docs/web-platform/deprecating-unload)). If you run Lighthouse to check Performances, SEO, and see Best practices, a warning displays.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/uCEqIcqruiaVJ16U_Ol7S_c0fa33895e1adf24d530c0edb0de080b45143a7403072d18d584ebd194100f13-image.png)

To prevent that, configure `disablePageUnloadEvents` in either of the following ways.

In `appSettings.json`:

```csharp
public void ConfigureServices(IServiceCollection services) {
    services.Configure<InstrumentationOptions>(o => o.DisableUnloadEvent = true);
}
```

In `EPiServer.CloudPlatform.Cms`:

```json
{  
  "EPiServer": {  
    "Cms": {  
      "Instrumentation": {  
        "DisableUnloadEvent": true  
      }  
    }  
}
```
