Coveo for Sitecore 5 is now available!

Customize Page Events Caption Displayed in Experience Profile

As stated in Understanding the Experience Profile, in the Visits section of the Experience Profile of a specific Contact, you can see the Coveo events with an appropriate caption for each kind of event.

You may want to change this caption to suit your own needs. The caption is directly related to the data that’s logged in the xDB for each event.

Events Caption Configuration

The Coveo event captions are built by processors defined under the /MySitecoreInstance/Website/App_Config/Include/ExperienceProfileCoveo folder in Coveo.ExperienceProfile.config.

This file usually looks like this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <group groupName="ExperienceProfileContactViews">
        <pipelines>
          <events>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithDocumentViewsEventData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithPagerEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithQueryEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithTopFieldSuggestionEventsData, Coveo.Analytics.xDB"/>
          </events>
          <latest-events>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithDocumentViewsEventData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithPagerEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithQueryEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithTopFieldSuggestionEventsData, Coveo.Analytics.xDB"/>
          </latest-events>
        </pipelines>
      </group>
    </pipelines>
  </sitecore>
</configuration>

The events section defines the caption of events that are displayed in the Visits section of the Experience Profile, while the latest-events section defines the caption of events displayed in the Overview section.

Defining Your Own Processor

If you wanted to change the caption of the Coveo event named Facet Slider Click, you would need to open the Sitecore Content Editor and look for the Facet Slider Click item GUID.

  1. Create a new C# project that references the Coveo.Analytics.xDB and the Sitecore.Cintel assemblies. These assemblies are located under <SITECORE_INSTANCE_ROOT>\website\bin. For this tutorial, the project is named FilteringTest.
  2. Create a new class. For this tutorial, the class is named PopulateEventsWithSliderData and is located in the FilteringTest namespace.

     using System;
     using Coveo.Analytics.xDB.Reporting;
     namespace FilteringTest
     {
         public class PopulateEventsWithSliderData : PopulateEventsWithCoveoData
         {
             private static readonly Guid[] s_EventGuids = {
                 Guid.Parse("7F2A1375-97B9-41C9-8F04-E0E5BC137440")
             };
             public PopulateEventsWithSliderData() : base(s_EventGuids, (s => "The slider was clicked."))
             {
             }
         }
     }
    

The processor inherits from PopulateEventsWithCoveoData, which is a user-friendly wrapper for PopulateAllEventsFromXdbBase. The base processor takes two parameters in the constructor: a list of event GUIDs on which the processor should be applied, and a function to display the actual caption. 

You can specify a function that actually uses data from the page event, such as the following:

(s => String.Format("Document clicked: \"{0}\"", s)

Doing so will make it use the Data field of the page event logged in the xDB. For now, compile your project and copy the resulting assembly to <SITECORE_INSTANCE_ROOT>\website\bin.

Add your newly created processor in a patch file of the Coveo.ExperienceProfile.config, such a Coveo.ExperienceProfile.Custom.config file as shown below. Save and close the file.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <group groupName="ExperienceProfileContactViews">
        <pipelines>
          <events>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithDocumentViewsEventData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithPagerEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithQueryEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithTopFieldSuggestionEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="FilteringTest.PopulateEventsWithSliderData, FilteringTest"/>
          </events>
          <latest-events>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithDocumentViewsEventData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithFacetSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithPagerEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithQueryEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithSortEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="Coveo.Analytics.xDB.Reporting.PopulateEventsWithTopFieldSuggestionEventsData, Coveo.Analytics.xDB"/>
            <processor patch:after="*[@type='Sitecore.Cintel.Reporting.Contact.Event.Processors.PopulateAllEventsWithSearchEventsFromXdb, Sitecore.Cintel']" type="FilteringTest.PopulateEventsWithSliderData, FilteringTest"/>
          </latest-events>
        </pipelines>
      </group>
    </pipelines>
  </sitecore>
</configuration>

Validating the Result

Reload the Sitecore Experience Profile and look for the Contact you were browsing at first. The events should now appear with their appropriate caption.

What's Next for Me?