HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Consumption Metrics

This topic describes the service consumption metrics, definitions and setup of usage parameters for solutions running in Optimizely Digital Experience Platform (DXP).

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

How it works

The consumption levels are defined when setting up service tiers, based on the estimated amount of generated traffic, as described in the Optimizely DXP Service Description. 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 (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.
  • Page  – Compiles content that is not a static file but has a URL and can be loaded in a browser. Depending on implementation, a page may map to an instance of a page type in Optimizely CMS or to a product in Commerce but 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 an URL, and can be downloaded as-is by visitors.

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

Single page applications

By default, page views are tracked when a new page loads into the browser. Websites based on the Single Page Application (SPA) concept are different, since 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:

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

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 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 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/.

You can see this JavaScript in dev tools as ai.0.js. You also see a POST request called Track that actually sends the data to application insights.

24962496

To contextualize the user, it also injects two cookies called ai_session and ai_user and passes these values to application insights in the POST request.

You can interact with this data in a few ways once the client telemetry has been sent to Application Insight.

1. The performance view

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

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 a period of time.

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.

4. Log analytics

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

Example queries

  1. View page views for the last 30 days
pageViews
| where timestamp > ago(30d)
| summarize count() by bin(timestamp, 1d)
| render timechart
  1. Count of unique users
pageViews
| where timestamp > ago(30d)
| summarize dcount(user_Id)
  1. Page views by site
pageViews
| where timestamp > ago(30d)
| extend site = split(url, "/")[2]
| summarize count() by tostring(site)

See the following topics:

Microsoft Documentation


Did this page help you?