Skip to end of metadata
Go to start of metadata

In this topic:

Page View events are logged each time a user visits a page. This information is sent to the Coveo Cloud Analytics service and provides data to Coveo Machine Learning for the Coveo Recommendations module (see Getting Recommendations). This page shows you how to configure your Page View Component to start logging Page View events.

Step 1 - Modify the Page View Analytics Component


As of the October 2016 release of Coveo for Sitecore, you can skip this step.

The first thing to do is to modify the page view analytics component file to add the content ID.

  1. Open the page view analytics file:
    1. When using Web Forms, go to <Sitecore Instance>\Website\layouts\Coveo, and open the CoveoPageViewAnalytics.ascx file.
    2. When using MVC, go to <Sitecore Instance>\Website\Views\Coveo, and open the PageViewAnalyticsView.cshtml file.
  2. Locate the following line:

  3.  After this line, add the following line: 

    1. In Web Forms:

    2. In MVC:

  4. Save and close the file.

Step 2 - Add the Component to a Layout

You can add the component to any Sitecore page that has a layout. Here are the steps to add the component to your page:

  1. Open the Sitecore Content Editor, and in the navigation tree, click your item. 
  2. In the Presentation tab, click Details.
  3. In the Layout Details dialog:
    1. Under Default, click Edit.
    2. In the Device Editor dialog:
      1. In the Controls tab, click Add.
      2. Add the Coveo Page View Analytics component:
        1. When using Web Forms, the item is located under Sublayouts > Coveo.
        2. When using MVC, the item is located under Renderings > Coveo.
      3. Enter the name of the placeholder to hold the Page View Component.
      4. Click Select.
    3. Click OK.
  4. Click OK.

If the component is correctly added, you should see Coveo Usage Anaytics Page View at the bottom of your page (or wherever you put your placeholder) when you open the page using the Experience Editor.


This text only appears in the Experience Editor and will not show in the published website.

Step 3 - Edit the Component Properties

If you wish, you can edit the component properties.

Content Type

The Pageview component has a Content Type property that is used to tag the current page to provide more specific information for the recommendation module. This property is optional and should be used solely to filter recommendations using items matching a specific tag. The values displayed for this property are stored in the TagRepository bucket, located under Sitecore > Settings > Buckets > TagRepository. Insert a Tag in this bucket to use it afterward in this field.

Custom Metadata

You can also specify custom metadata which will be returned when exporting the data from the analytics.


If the User Context Component is added before the Page View component, the Page View events will contain this user context (see Leveraging User Context for Coveo Machine Learning).

  • No labels