When you initiate a session with the startSession method, session data is loaded into memory. Throughout the session, you can read and write to the session data (which is a superset of the static profile data). The session contains the following data:
All session data is available until you call the endSession method, or the
sessionTimeout time elapses. Once the session ends, all data not explicitly saved to contact or response history or some other database table is lost.
You can create these name-value pairs as you work with the Interact API. You do not need to declare all name-value pairs in a global area. If you set new event parameters as name-value pairs, the runtime environment adds the name-value pairs to the session data. For example if you use event parameters with the
postEvent method, the runtime environment adds the event parameters to the session data, even if the event parameters were not available in the profile data. This data exists in the session data only.
You can overwrite session data at any time. For example, if part of the customer profile includes creditScore, you can pass in an event parameter using the custom type
NameValuePair. In the
NameValuePair class, you can use the
setName and
setValueAsNumeric methods to change the value. The name needs to match. Within the session data, the name is not case-sensitive. Therefore, the name
creditscore or
CrEdItScOrE would both overwrite
creditScore.
Only the last data written to the session data is kept. For example, startSession loads the profile data for the value of
lastOffer. A
postEvent method overwrites
lastOffer. Then a second
postEvent method overwrites
lastOffer. The runtime environment keeps only the data written by the second
postEvent method in the session data.