Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
CDPCloud Portal
Sitecore CDP
  • Data browser
        • Define, store, and access session traits
        • Limitations
        • Create a session trait
        • Create a session trait with the Code Assistant
        • Code snippets
        • Test a session trait
        • Activate a session trait
        • Manage session traits
        • Session trait statuses
        • Troubleshooting session traits
    • Batch uploads
    • Copying entities between tenants
  • Glossary
  1. Session traits
  1. Sitecore CDP
  2. Developer center
  3. Session traits
  4. Test a session trait

Test a session trait

We recommend that you test a session trait before activating it in Sitecore CDP to identify any errors and ensure optimal performance. Testing involves previewing the session trait for a single customer. A successful test indicates that the session trait's JavaScript code is correctly configured.

To test a session trait:

  1. Open the session trait and click Test Test icon.

    Test a session trait by running its logic against a selected guest.
  2. In the Test dialog, select a guest to test against by doing one of the following:

    • To select a random guest based on guest type, click in the search box and select Visitor or Customer.

    • To select a specific guest, enter their unique identifier into the search box. You can search for a guest using, for example, an email address, other unique identifier, or browser ID.

    • To select a recently used guest, click the Recent option.

    • To select a bookmarked guest, click the Bookmark option.

    Tip

    You can manually edit the data displayed for the selected guest before initiating the test. This lets you test the session trait logic without the need to find or create a specific guest profile with the relevant attributes.

  3. Click Test to simulate how the session trait would function in production with the selected guest. The latest session that have a type of Web and status Closed will be used for the test. The test also includes validating the JavaScript and output values. Review any validation messages, make the necessary code updates, and retest when needed.

    The test will display the output of the session trait, including its runtime and any logs, on the Response tab.

If you have suggestions for improving this article, let us know!

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use