Capture a page view event

This is for:

Developer
Warning

The page view event has been deprecated and is no longer necessary to send. Unless you are creating custom reports using this event, we recommend that you stop sending it, as doing so will simplify your implementation.

The article explains how to capture page view events and send the information to Coveo along with site information using the Coveo UA library.

When to send a page view event

Collecting page view data lets you measure the number of views you had for a specific page on your website. A page can represent an HTML document, a URL, or any dynamically loaded content. There should be exactly one pageview event sent for each client-side view of a specific URL. The pageview event must be sent immediately after the page has loaded.

Capture a page view event using Coveo UA library commands

The following command sends an event that includes the current page’s information:

coveoua('send', 'pageview');

Page view dataset requirements

The following table lists the fields sent along with the event and the solutions that leverage them. Search, Listings, and Recs columns refer to whether the ML that powers those solutions needs those data points. The Reporting column is for general reporting purposes that encompasses all solutions. The title and location fields are automatically populated by Coveo UA. Therefore, when implementing with Coveo UA, there’s no required data to be added along with the send command.

Field Priority Search Listings Recs Reporting

title

Recommended

check

location

Required

check

Refer to Page fields reference for other fields that you can optionally send for reporting.

Page view event validation

To validate the page view event was sent, use the developer tools for client-side request verification to inspect your visit to ensure everything done using the UI is captured as a set of consistent and coherent events. This must occur after the implementation is applied.

Inspect the page view event through the network browser and ensure it satisfies the following:

Barca page view event network browser

1 A pageview event is sent on every newly opened page and value of the t parameter should be pageview.

2 The location is correctly indicated in the dl parameter.

3 The page title is correctly indicated in the dt parameter.

Event field data mapping

The following table shows how the client-side fields are mapped to parameters in the analytics request sent to Coveo UA. You need to ensure this information is properly passed in the payload.

Field name Description Parameter

title

The title of the webpage

dt

location

The full URL of the page

dl

For a complete list of view parameters that can be sent in the event, see ​​Log collect events.