DEV Community

Cover image for Building decision models with Sitecore Personalize: usage of programmable nodes
Anna Bastron
Anna Bastron

Posted on • Edited on • Originally published at linkedin.com

Building decision models with Sitecore Personalize: usage of programmable nodes

In our recent research of Sitecore CDP and Personalize, my colleagues and I looked into decision models, aiming to understand how to dynamically recommend the most relevant content variants based on specific rules. We soon discovered that decision models offer much more than a simple drag-and-drop canvas! In this article I will focus on programmable nodes, an important element of the toolset available to us in Sitecore Personalize.

Decision Model in Sitecore Personalize

Understanding decision models

Decision models are the foundational element of personalised content delivery in Sitecore Personalize. They incorporate several essential components:

  1. Programmable nodes: these nodes are where the magic happens. Technical users familiar with JavaScript can utilise programmable nodes to define custom business logic for dynamic decision making.
  2. Offers: content repositories that can be used for generating recommendations. Offers are what users eventually see on your platform.
  3. External systems: connections to external analytical models or data systems that help drive decisions within the models. A typical reason for using an external system in a decision model is to retrieve data or perform a calculation and then pass it into another decision component.
  4. Decision tables: a powerful tool for crafting decision logic that allows you to map conditions and outcomes efficiently.

The importance of programmable nodes

Programmable nodes are where developers and marketers collaborate to fine-tune the decision models. These nodes allow you to incorporate server-side JavaScript to process and analyse user behaviour data captured from Sitecore CDP across multiple sessions.

Why are programmable nodes so important?

  1. Flexibility: programmable nodes offer unparalleled flexibility, enabling you to implement custom business logic tailored to your specific requirements.
  2. Access to user data: you can access guest objects and their properties from programmable nodes, including data extensions, sessions, orders, and more. This rich data allows you to make decisions and identify which content to display for this guest.
  3. Endless possibilities: with JavaScript expertise at your disposal, there are plenty of possibilities. You can easily write custom code to meet your business expectations and create unique, engaging user experiences.

Creating custom programmable nodes in Sitecore Personalize

To illustrate the process, let's look at an example of a custom programmable node. Imagine you want to calculate the total number of "VIEW" events across all sessions for a given user and output it as an integer.

In this code snippet, we define a function called getNumberOfEvents that calculates the number of "VIEW" events within each session and returns the total count.

Custom programmable nodes for unique use cases

Besides event calculations, you can build programmable nodes to cater to various other use cases. For instance, you could check the session state to determine if a user's session is still active:

Alternatively, you might want to trigger specific actions based on the last event type, such as completion of checkout:

Empowering personalised experiences

Programmable nodes in Sitecore Personalize provide a powerful tool to create highly personalised user experiences. By leveraging server-side JavaScript and collaborating with technical experts, marketers can configure decision models to cater for various scenarios and user preferences. So, unlock the potential of programmable nodes and deliver outstanding content tailored precisely to your users' needs! 🚀

For a detailed guide on creating decision models, check out my colleague's article here. Once you have that foundation, you're all set to start your journey of customisation with programmable nodes. In my next articles I will talk more about other technical features of Sitecore Personalize. Stay tuned! 😊

Top comments (0)