Understand customer interests with clickstream analysis

This code pattern is part of the Db2 Event Store learning path.


If you are interested in clickstream analysis with interactive visualization, this code pattern is for you. This code pattern uses Scala in a Jupyter Notebook to ingest and analyze clickstream data. The data is fed into IBM Db2 Event Store, which is optimized for event-driven data processing and analytics. Brunel is used to create interactive charts to visualize customer behavior.


Business success hinges on customer knowledge. You need to understand what motivates them to buy something, what forces them off a page, mainly you need to know your customer. This code pattern shows how a retail business uses IBM Db2 Event Store to capture and analyze clickstream data from its web channels. The clickstream analysis helps the business to closely track customer browsing patterns and better understand their changing interests. Acting on the insights provided, the business provides a personalized experience to every customer with targeted offers to drive sales.

Sample notebooks demonstrate the use case of clickstream analysis with IBM Db2 Event Store using Scala APIs to ingest and analyze web event data. IBM Db2 Event Store offers high-speed ingestion and real-time analytics for large volumes of streaming data. The platform enables event-driven applications to persist event data at scale and powers high-performance Spark analytics on all data for quick insights.

Using Spark SQL and Brunel visualizations, interactive charts show the popularity of product lines, products, and features – based on page hits and time spent on web pages. A view of a specific customer’s most recent interests and activity over time is shown by drilling down to that customer’s activity.

After you complete this code pattern, you will understand how to:

  • Install IBM Db2 Event Store Developer Edition
  • Ingest data into Event Store using Scala in a Jupyter Notebook
  • Query the Db2 Event Store using Scala and Spark SQL in a Jupyter Notebook
  • Use Brunel to visualize the data with interactive charts



  1. Add a CSV file as a data asset.
  2. Run a Jupyter Notebook using Scala to ingest data from the CSV file into Db2 Event Store.
  3. Run a Jupyter Notebook using Scala and the Brunel visualization language to analyze the data from Db2 Event Store.


Find the detailed steps for this pattern in the README. The steps show you how to:

  1. Install IBM Db2 Event Store Developer Edition.
  2. Clone the repo.
  3. Add the CSV file as a data asset.
  4. Import and run the Jupyter Notebook to ingest data.
  5. Import and run the Jupyter Notebook to analyze the data.
  6. See the results.


This code pattern showed you how to ingest clickstream data and analyze your website customer activity with interactive visualizations. The code pattern is part of the Learning Path: Db2 Event Store series. To continue the series and learn about Db2 Event Store features, take a look at the next code pattern, Analyze IoT sensor data with machine learning and advanced analytics.