Digital Developer Conference: Cloud Security 2021 -- Build the skills to secure your cloud and data Register free

Capture clickstream data from your ecommerce website

Summary

In this developer code pattern, we will show how to create a database of ecommerce clickstream data with DataStax Enterprise or Apache Cassandra. Using Red Hat OpenShift and the DataStax Kubernetes Operator for Apache Cassandra, you can deploy this distributed database on-premises or on your cloud provider of choice with a unified OpenShift experience. If you prefer a database-as-a-service provider, get up and running quickly with IBM Cloud Databases for DataStax.

Description

The provided ecommerce website is built using server-side rendering (SSR) with Next.js and React components. As customers browse the web pages, SSR quickly (and asynchronously) inserts browsing data in the database for each page rendered. When the customer clicks the “Add to cart” button, the client-side React component uses Next.js API routes to add that clickstream data. The DataStax Enterprise database is optimized for low-latency fast writes and is designed to be highly scalable. This make DataStax Enterprise a great fit for collecting high-volume clickstream data.

When you have completed this code pattern, you will understand how to:

  • Select a cloud, cluster, or development platform for Apache Cassandra or DataStax Enterprise
  • Provision DataStax Enterprise or a DataStax distribution of Apache Cassandra
  • Design and create a database for DataStax Enterprise
  • Use CQL and cqlsh to create and query your database
  • Build and run the Next.js web app, which tracks clickstream data

Flow

Flow diagram

  1. Users interact with ecommerce website.
  2. Web pages and components capture clicks.
  3. Clickstream data is stored in a fast-write highly scalable database.

Instructions

Get detailed instructions from the README file. Those instructions explain how to:

  1. Deploy DataStax Enterprise or Apache Cassandra
  2. Interact with your database using CQL and cqlsh
  3. Interact with your database using the DataStax Node.js client

This code pattern is part of the Develop an intelligent inventory and procurement strategy using AI series.