Back Arrow
From the blog

Sitecore Personalize: tips & tricks for decision models and programmable nodes

We've collected various findings around decision models and programmable nodes working with Sitecore Personalize.

Anna Gevel

Sitecore MVP

Remember to return a value from programmable nodes

Starting with a fundamental tip: when creating custom programmable nodes, ensure you include a "return" statement at the end of the JavaScript function. It's easy to overlook, but without it, your decision model might return unexpected results.

When I added my very first custom programmable node to a decision model, it took me a while to find why the model was working incorrectly. It turned out my programmable node was calculating everything correctly, but there was no "return" statement after calling an internal function. I don't know how I expected Sitecore Personalize to know which value to use!

The "return" statement at the end of the programmable node is important

Set the correct return type in programmable nodes

Specify the correct return type in programmable nodes, aligning it with the decision table's comparison rules. Whether it's integer, long, double, string, boolean, date, or map, choosing the right type is necessary for seamless integration with the decision table.

This is the data type we will be using later for comparing values in the decision table

Avoid leaving empty lines in decision tables

They are not as empty as I thought! Beware of seemingly harmless empty lines in decision tables. A forgotten line can lead to hit policy errors or produce incorrect output, because hyphens in input columns act as wildcards. For instance, in the example below, the first row applies to all guests of "customer" type, irrespective of their page views count.

Line #4 is not empty, it will match guests of any type and with any number of events

Name decision table output columns carefully

When naming output columns in decision tables, remember that output of the decision models can be used in Freemarker templates for web or full stack experiences. Opt for output reference names without spaces or special characters for easier integration later.

Make sure the output reference is Freemarker-friendly

Pay attention to workflow in decision model

Before using a decision model, move at least one variant to the production state. Once in production, the variant becomes non-editable so make sure to test it before moving it to production. But don't worry, if any changes are required further down the line, you can always duplicate the live variant and update the newly created draft.

Keep at least one variant in the Production column for get decision model results

Save decision model versions with comments

When making significant changes to your decision model variant, choose the "Save with comment" button. Comments will be visible in the revision log, making it easier to track changes. They will also help finding the right version to revert to if that's required.

Comments will help to find the right version in the revision table

Use the right case in input columns

Be cautious with the values in decision model input columns as they are case-sensitive. Inconsistent cases may lead to unexpected behaviour, so ensure you are using the right values, especially when copying them from other sources.

Input column values are case-sensitive

Use decision templates

If there is a programmable node that you or your marketing team will likely reuse, then consider saving it as a decision template. Decision templates allow adding configurable parameters that will be displayed as a user-friendly form and you won't need copying the same JavaScript code from one decision model to another.

Friendly UI of decision templates

Watch executionTime in test canvas

This is probably the most important recommendation from me: optimise performance of your decision models. Regardless of the type of experience and integration approach you use, long execution times will negatively affect user experience on the website and all other channels connected to Sitecore Personalize.

To ensure the most efficient performance, Sitecore Personalize imposes data limits on the amount of data that is available in decisioning and conditions. In addition to this, you can apply the following techniques to improve execution time of programmable nodes and decision models:

  • Look only at the data that you need by limiting the number of sessions and events you check
  • Break the loops and return values from functions as soon as you have found what you need to avoid accessing and iterating through unnecessary data
  • Leverage batch segments and user data extensions where possible to make decisions based on already calculated and saved data
  • Reduce the number of elements and connections on the decision canvas
  • Limit the number of programmable decisions on the canvas to three or four as recommended by Sitecore. If multiple programmable decisions use the same data, consider combining them into one element.
  • Keep the number of external data systems and AI models minimal in a decision model. Sitecore recommends to include one or two data systems and/or AI elements.
  • Reduce the number of rows and columns in decision tables. Where possible, combine conditions by using hyphen (-) to eliminate unnecessary checks.
  • Ensure that the model returns only one decision
Watch execution time of the model and its individual elements in the test canvas

It's easy to start working with us. Just fill the brief or call us.

Find out more
White Arrow
From the blog
Related articles

Mastering advanced tracking with Kentico Xperience

Dmitry Bastron

We will take you on a journey through a real-life scenario of implementing advanced tracking and analytics using Kentico Xperience 13 DXP.


Sitecore integration with Azure Active Directory B2C

Dmitry Bastron

We would like to share our experience of integrating Sitecore 9.3 with the Azure AD B2C (Azure Active Directory Business to Consumer) user management system.


Activity logging with Xperience by Kentico

Dmitry Bastron

We'll dive into practical implementation in your Xperience by Kentico project. We'll guide you through setting up a custom activity type and show you how to log visitor activities effectively.


Why is Kentico of such significance to us?

Anastasia Medvedeva

Kentico stands as one of our principal development tools, we believe it would be fitting to address why we opt to work with Kentico and why we allocate substantial time to cultivating our experts in this DXP.


Interesting features of devtools for QA

Chrome DevTools serves as a developer console, offering an array of in-browser tools for constructing and debugging websites and applications.


Where to start learning Sitecore - An interview with Sitecore MVP Anna Gevel

Anna Gevel

As a software development company, we at Byteminds truly believe that learning and sharing knowledge is one of the best ways of growing technical expertise.


Sitecore replatforming and upgrades

Anastasia Medvedeva

Our expertise spans full-scale builds and support to upgrades and replatforming.


Kentico replatforming and upgrades

Anastasia Medvedeva

Since 2015, we've been harnessing Kentico's capabilities well beyond its core CMS functions.


Umbraco replatforming and upgrades

Anastasia Medvedeva

Our team boasts several developers experienced in working with Umbraco, specialising in development, upgrading, and replatforming from other CMS to Umbraco.


How we improved page load speed for Next.js ecommerce website by 50%

Sergei Pestov

How to stop declining of the performance indicators of your ecommerce website and perform optimising page load performance.


Fixed Price, Time & Materials, and Retainer: How to Choose the Right Agreement for Your Project with Us

We will explain how these agreements differ from one another and what projects they are suitable for.

Customer success

Enterprise projects: what does a developer need to know?

Let's talk about what enterprise development is, what nuance enterprise projects may have, and which skills you need to acquire to successfully work within the .NET stack.


Headless CMS. Identifying Ideal Use Cases and Speeding Up Time-to-Market

Andrey Stepanov

All you need to know about Headless CMS. We also share the knowledge about benefits of Headless CMS, its pros and cons.

Headless CMS

Dynamic URL routing with

We'll consider the top-to-bottom approach for modeling content relationships, as it is more user-friendly for content editors working in the admin interface.

Kontent Ai
This website uses cookies. View Privacy Policy.