← Back to list

How to Track User’s Activity in Application with Apache Unomi

APACHE UNOMI WEB TRACKING TUTORIAL

Raj Dodiya · 2024-02-12 18:30 · 1 claps · 4.0 min read
#apache #unomi #web-tracking #user-activity-tracker #js
Open on Medium ↗

How to Track User’s Activity in Application with Apache Unomi

APACHE UNOMI WEB TRACKING TUTORIAL

In the world of web personalization, Apache Unomi is a powerful tool. In this tutorial, we'll guide you through the installation and configuration process, helping you unlock the potential of Unomi for your web projects.

Table of Contents:

  1. Introduction
  2. Understanding Unomi Terms
  3. Prerequisites
  4. Installation
  5. Configuration (Optional)
  6. References
  7. Conclusion
  8. Before We End

👉 Introduction

Apache Unomi is an open-source customer data platform designed for collecting, storing, and processing user data. It allows you to create personalized user experiences by leveraging this data.

Apache Unomi is a REST server that manages user profiles and events related to the profiles. It can be used to integrate personalization and profile management within very different systems such as CMS, CRMs, Issue Trackers, native mobile application.

Basically the server tracks users using different mechanisms (by default cookies), builds a progressively populated profile and associates events that are performed by a user with his profile. Events may range from a click on a page, to a file being downloaded, a native mobile application button being clicked, or anything that can be sent to the server.

👉 Understanding Unomi Terms

Let’s understand some basic terms which are usefull while tracking user’s activity using Apache Unomi.

  1. **Cookie : *A cookie is a small file that a website sends to your computer*. The file contains information about how you use the site, so that it’s available the next time you use the site. Apache Unomi uses browser cookie to store user tracking data and send it to Unomi server.
  2. Item: Unomi structures the information it collects using the concept of Item which provides the base information the context server needs to process and store the data. Items are a generic object, that is common to many objects in the data model. It contains the following fields, itemId, itemType and scope.
  3. **Scope : **Scopes are objects which simply contains unique strings that are used to “classify” the item objects. Unomi defines a built-in scope (called systemscope) that clients can use to share data across scopes.
  4. Event : Events represent something that is happening at a specific time (they are timestamped). They can be used to track visitor behavior. Events is a item whose itemType is event and it is send as item object. Events are persisted and immutable, and can also be triggered as part of Unomi’s internal processes for example when a rule is triggered.
  5. *Profile : *A profile is an Item with any number of properties and optional segments and scores.By processing events, Unomi progressively builds a picture of who the user is and how they behave. This knowledge is embedded in Profile object. It has an itemId (ProfileId) which is stored in cookie.
  6. **Session : **A session represents a period of time during which a visitor/profile has been active. It makes it possible to gather data and then use it for reporting and further analysis by regrouping all the events that occurred during the session. It is an Item .It has an itemId (SessionId) which is stored in cookie.
  7. Json Schema : *JSON Schema is a powerful standard for validating the structure of JSON data. JSON Schema is used in Unomi to validate the data coming from the two public endpoints /contextRequest and /eventCollector. In Unomi, each event type must have an associated JSON schema. To validate an event, Unomi will search for a schema in which the target of the schema is events, and with the name of the schema matching the event type.*
  8. Rule : Rule is an item . It contains conditions , actions and metadata.Rules are a powerful ways to react in real-time to incoming events. Apache Unomi has a built-in rule engine that is one of the most important components of its architecture. Every time an event is received by the server, it is evaluated against all the rules and the ones matching the incoming event will be executed.

👉 Prerequisites

Before we start, make sure you have the following:

  • Java Development Kit (JDK) 11 or higher and make sure you set the JAVA_HOME variable (reference) (see Getting Started guide for more information on JDK compatibility)
  • ElasticSearch : download 7.17.5 version of Elastic Search
  • Apache Unomi : download 2.4.0 version of Apache Unomi’s zip file of Binary Distribution
  • A web application or website where you want to implement personalization (Currently, for tutorial we will create basic HTML,CSS,JS)

I prefer JDK 11 because Apache Unomi is most tested with JDK 11. It is highly recommended to use the ElasticSearch and Unomi version specified in the documentation whenever possible.

👉Installation

Follow below steps:

  1. Download Elastic Search from above url , uncompress it and change the config/elasticsearch.yml to include the following config :
cluster.name: contextElasticSearch

2. Launch ElasticSearch using : bin/elasticsearch.bat

Go to bin folder and run elasticsearch.bat file

3. Download and launch Apache Unomi using : bin/karaf.bat

Uncompress the Unomi and go to bin folder and run karaf.bat file or open cmd and go to path where bin file is located and run karaf.bat .

Wait for startup to complete

Check whether Unomi is running properly or not

Try accessing https://localhost:9443/cxs/cluster with username/password: karaf/karaf .

👉 Configuration (Optional)

Now, let’s configure Unomi for your specific needs.

  1. Edit the unomi-config.properties file.
  2. Configure data sources and connectors.
  3. Save your changes.

For now this is optional we are not going to change anything in configuration.

👉 References

👉 Conclusion

Unlock the power of personalization with Apache Unomi. By following this tutorial, you’re on your way to creating more engaging and tailored user experiences. You’ve learned how to install, configure, and run Apache Unomi.

👉 Before We End..

Feel free to ask questions or share your thoughts in the comments. I am here to help! I hope you enjoyed reading this article and found it insightful. If you think this blog post could benefit others, please consider sharing it with your network, colleagues, or friends. and follow me for more techs related blogs.

Keep an eye out for our next tutorial on Apache Unomi.


메타데이터
post_id
bf7908f9261a
slug
how-to-track-users-activity-in-application-with-apache-unomi-bf7908f9261a
url
https://medium.com/@rdodiya2001/how-to-track-users-activity-in-application-with-apache-unomi-bf7908f9261a
canonical_url
https://medium.com/@rdodiya2001/how-to-track-users-activity-in-application-with-apache-unomi-bf7908f9261a
author_url
https://medium.com/@rdodiya2001
status
ok
fetched_at
2026-08-07 04:54:46