2. Add a Document Types Collector and Characteristic

Previous

Add a Collector

The first step for adding document type views to the visitor profile is to collect the visited document types. Such data collection is done by a collector. This example uses the existing DocumentTypesCollector in the Relevance Module.

Using the Console, browse to /targeting:targeting/targeting:collectors.

Add a node documenttypes of type targeting:collector.

Add a property targeting:className to the new node with the value com.onehippo.cms7.targeting.collectors.DocumentTypesCollector.

Add a Characteristic

The next step for adding document type views to the visitor profile is to add a document type characteristic. A characteristic is measurable property of a visitor, like 'the document types a visitor has seen'.

A characteristic needs some additional configuration for the backend, and some configuration and code for the frontend.

Using the Console, browse to /targeting:targeting/targeting:characteristics.

Add a node documenttype of type targeting:characteristic.

Add a property targeting:collector to the new node with value documenttypes.

Add a property targeting:scorerClassName to the new node with value com.onehippo.cms7.targeting.scoring.VectorScorer.

Since the news article page is backed by a myproject:newsdocument, the REST output of the visitor should now show that the visitor has seen myproject:newsdocument once.

Tip: add a browser extension to nicely format JSON output. For example, the 'JSONView' extension available for Chrome and Firefox.

In the CMS

The list of characteristics in the Characteristics tab of the Audiences perspective in the CMS will now contain an additional entry 'documenttype' (make sure to first refresh the CMS UI in your browser). However, we would like to have a nicer description there like "has seen (document type)", and a nice editor for the target groups, etc. That's all taken care of in the next step.