Using ObservableAggregator<T> to filter items

Current version: 9.2

You can configure instances of ObservableAggregator<T> processors that filter out items that you do want to be not be sent to observers. All observables use the global aggregation.filter.inbound pipeline. You can add additional observable-specific pipelines.

Configuration

You implement the global aggregation filter in XML. The following code adds two filters. The first one filters by contact ID and the second one by the path visited:

RequestResponse
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">  <sitecore>
    <pipelines>
      <!-- global aggregation inbound filters-->
      <aggregation.filter.inbound>
        <processor type="Sitecore.ContentSearch.Analytics.Pipelines.AggregationFilters.InboundContactIdFilter, Sitecore.ContentSearch.Analytics">
          <filters hint="list:AddFilter">
            <filter>ca82109f-30cd-4414-956e-caea41c7510c</filter>
          </filters>
        </processor>
        <processor type="Sitecore.ContentSearch.Analytics.Pipelines.AggregationFilters.InboundVisitPathFilter, Sitecore.ContentSearch.Analytics">
          <filters hint="list:AddFilter">
            <filter>/default.aspx</filter>
          </filters>
        </processor>
      </aggregation.filter.inbound>
    </pipelines>
  </sitecore>
</configuration>
You can configure each processor in the sample above with additional <filter> values.

Observable specific filter

You can configure an observable-specific pipeline in addition to the global filter pipeline. If you configure an observable called DefaultObservable, you simply configure a pipeline called defaultobservable.filter.inbound. For example:

RequestResponse
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <!-- define the aggregator -->
      <aggregation>
        <processor patch:before="*[1]"
                   type="Sitecore.ContentSearch.Analytics.AnalyticsObservableAggregator, Sitecore.ContentSearch.Analytics">
          <!-- here we name the aggregator -->
          <param desc="name">DefaultObservable</param>
        </processor>
      </aggregation>
      <!-- specific inbound filter for an aggregator -->
      <!-- we use the aggregator name from above in the pipeline name -->
      <defaultobservable.filter.inbound>
        <processor type="Sitecore.ContentSearch.Analytics.Pipelines.AggregationFilters.InboundVisitPathFilter, Sitecore.ContentSearch.Analytics">
          <filters hint="list:AddFilter">
            <filter>/other.aspx</filter>
          </filters>
        </processor>
      </defaultobservable.filter.inbound>
    </pipelines>
  </sitecore>
</configuration>

This configuration uses exactly the same processor types as the global pipeline. Sitecore only applies the processors in the pipeline when the DefaultObservable processor is filtering items.

Do you have some feedback for us?

If you have suggestions for improving this article,