Session storage of shopper data
Key Takeaway
Put shopper data in session.privacy unless it builds dynamic customer groups. session.privacy values are cleared at logout, but session.custom values are not. Store small values, such as IDs, rather than whole objects.
The session (the dw.system.Session class) holds server-side data for one shopper across requests. You can store small custom values in it through session.privacy or session.custom. The two differ in system cost and in what happens when the shopper logs out. The session has strict type and size limits, so the best practice is to store small values, such as IDs, rather than whole objects.
What the session is
dw.system.Session represents one shopper's session in B2C Commerce. Besides built-in attributes, such as the current customer and the click stream, the session can store custom values that you write through session.privacy or session.custom.
Use the session to cache smaller pieces of information for a shopper across requests. Caching in the session is easy to implement. Session data can also be used to build dynamic customer groups.