1. Include the Relevance Module in a project
Start with a clean Hippo Enterprise project created from the Hippo archetype, as explained in Setting up a Hippo Enterprise project.
The following steps explain how to add the Relevance Module to this archetype project. After the steps explained below, the CMS should contain an additional perspective called the 'Audience perspective'.
1. Add Maven Dependencies
Add the following Maven dependencies:
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-dependencies-cms</artifactId> <type>pom</type> </dependency>
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-targeting-dependencies-site</artifactId> <type>pom</type> </dependency>
2. Add Geo Location Database
The Relevance Module uses the geo location database of MaxMind to map IP addresses to cities and countries. This database comes in two flavors:
To use the free GeoLite City database for hippo targeting 2.26.01 or later, add the following dependency to your site's pom.xml:
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-maxmind-geolite2</artifactId> <version>20160405</version> <scope>runtime</scope> </dependency>
3. Configure the Data Storage
If you are following this tutorial in a local development environment you can use the default data store configuration, which is the in-memory data store. Note that this is not a cluster-aware solution, so it is not possible to see all visitors to all site nodes. Another disadvantage is that when the session expires the visitor data are lost. Returning visitors cannot be identified nor their previously built-up data restored.
Note that when using Experiments and/or Trends (not covered in this tutorial) the In-Memory stores cannot be used even in a local development environment. In this case you can use the Elasticsearch data store in local development.
If you are setting up a production environment you should not use the in-memory data store at all. You must configure the Couchbase data store for requests, visitors and statistics and the Elasticsearch data store for visits.
4. Add New Loggers to log4j-dev.xml and log4j-prod.xml
By default all relevance logs are written to hippo-cms.log. However all relevance code except for the Visitor Analysis runs in the site webapp. Hence, make sure you add to conf/log4j-dev.xml and conf/log4j-prod.xml the following loggers:
<logger additivity="false" name="com.onehippo.cms7.targeting.frontend"> <level value="warn"/> <appender-ref ref="cms"/> <appender-ref ref="console"/> </logger> <logger additivity="false" name="com.onehippo.cms7.targeting"> <level value="warn"/> <appender-ref ref="site"/> <appender-ref ref="console"/> </logger>
5. Rebuild and Restart
6. Add the News Feature
For the running example there should be at least one document type in the project.
Open the setup application:
and add the News feature from the library.
7. Rebuild and Restart
Stop the application, and rebuild and restart it once more.