Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Introduction to Sitecore Personalize
Managing accounts and system settings
Identifying guests
Introduction to experiments
Introduction to experiences
Decisioning
View dashboards
Developer Center
Connecting to an external system
Using client-side JavaScript
Using server-side JavaScript
AI in Personalize
Glossary
  • Sitecore Personalize
  • Introduction to decisioning in Sitecore Personalize
  • Managing programmable decisions
  • Including print statements in programmable decisions

Including print statements in programmable decisions

It's best practice to include  print() statements in programmable decisions because they can help in debugging and understanding the flow of execution. These print() statements let you view the programmable output on the Logs tab, up until the point the code throws an error. This makes it easier for you to check the programmable functions that are working as expected and identify specific segments of the code that are causing errors when you test the decision model variant.

The following image shows an example of adding three print() statements for the guest's gender, city, and guestType to test a programmable.

Adding print statements in a programmable component to print guest data.

On the Test Canvas, on the Logs tab, you'll see the programmable test results, where the output for the guest's gender, city, and guestType are printed.

Displaying print statement results in the Logs tab.

For enhanced debugging, you can also print entire JavaScript objects using the print(JSON.stringify(example)); statement. This outputs the object in a readable, formatted JSON structure with line breaks and indentation.

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2026 Sitecore