Configure the Facets for Trends

Overview

The Trends tab in the Content audience application displays a list of facets—visitor characteristics—that CMS users can use to select visitor segments and measure content performance. You can configure which facets are available. Facet configuration is stored in the repository and can be managed using the Console.

You can:

  1. Add, remove, or reorder facets.
  2. Change the display label for a facet.
  3. Specify the Elasticsearch field from which a facet retrieves its data.

Configuration Location

Facet configuration is stored as targeting:facet nodes at the following repository path:

/targeting:targeting/targeting:trends/targeting:facets

To modify the facets shown in the Trends tab, update the child nodes under this path. You can add, remove, or reorder these nodes as needed. Each targeting:facet node requires the following properties:

  • targeting:facetName (string): A keyword-style name used in table headers and the "Peak performing [FACET]" dropdown.
  • targeting:filterName (string): A phrase that completes the sentence "When the visitor...".
  • targeting:esField (string): The Elasticsearch field used to retrieve data for this facet.

Example configuration:

facetName = country
filterName = comes from country
esField = requests.collectorData.geo.country

Using Data from Collectors

For data collected by Collectors, set the esField property using the following format:

requests.collectorData.COLLECTORNAME.FIELDNAME
  • COLLECTORNAME: The node name of the collector configuration under /targeting:targeting/targeting:collectors.
  • FIELDNAME: The name of a String property in the collector’s Targeting Request Data bean, which is returned by:
getTargetingRequestData(HttpServletRequest request, boolean newVisitor, boolean newVisit, T previousTargetingData)

For example, the GeoIPCollector returns a GeoIPTargetingRequestData object:

public static class GeoIPTargetingRequestData { private String country; private String city; private double latitude; private double longitude; public void setCountry(final String country) { this.country = country; } public String getCountry() { return country; } public void setCity(final String city) { this.city = city; } public String getCity() { return city; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLatitude() { return latitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLongitude() { return longitude; } }

If this collector is configured with the node name geo, valid values for targeting:esField include requests.collectorData.geo.country and requests.collectorData.geo.city.

Note: Elasticsearch 2 does not allow dots in field names. If a collector gathers data with dots in the field name, those dots are replaced with underscores. When configuring esField, use underscores instead of dots. For example, if you collect a cookie named x.y, set FIELDNAME as x_y in the targeting:esField value.

Using Augmented Request Data

If your project augments request log entries as described in Augmenting RequestLog data, you can reference this data using:

requests.data.FIELDNAME

Replace FIELDNAME with the specific property name.

Example esField Values

Below are example esField values for common collectors and request log data:

  1. requests.collectorData.categories.terms (category, from com.onehippo.cms7.targeting.collectors.TagsCollector)
  2. requests.collectorData.geo.country (country, from com.onehippo.cms7.targeting.collectors.GeoIPCollector)
  3. requests.collectorData.geo.city (city, from com.onehippo.cms7.targeting.collectors.GeoIPCollector)
  4. requests.collectorData.pageviews (page views, from com.onehippo.cms7.targeting.collectors.PageViewsCollector)
  5. requests.collectorData.doccreatedby.terms (created by, from com.onehippo.cms7.targeting.collectors.DocumentPropertyCollector)
  6. convertedGoals.name (converted goal, from Experiments data)
  7. requests.pathInfo (visited URL, from the request log entry)

Viewing Elasticsearch Mapping

To review all available fields in your Elasticsearch store, access:

http://<elasticsearch-location>/<indexname>/_mapping?pretty

Replace <elasticsearch-location> and <indexname> with the corresponding values from /targeting:targeting/targeting:datastores/visits. The output provides a complete list of fields, though it may be difficult to read.

Share Feedback
Page: /build/enterprise-plugins/targeting-relevance/configure-trends
Section: Build
Category *