A session attribute is a pre-defined variable that is persistent throughout the life of a Tealeaf session. Session attributes can be used to store various data that may be referenced by events at any point during the session.
There are two types of session attributes:
- System Session Attributes: Tealeaf provides a set of session attributes, or out of the box session attributes, that are automatically tabulated and updated by the Canister. These attributes are available for use in generating events through the Event Manager.
- User-Defined Session Attributes: Through the Event Manager, you may create up to 64 session attributes for tracking session data specific to your web application.
Note: Write access to user-defined session attributes is permitted only through the defined action of an event.
- Session attribute values are strings with a maximum length of 255 characters.
- Session attributes are indexed automatically.
You assign and reassign values to session attributes through events.
Session attributes can be configured to hold string or numeric values. By definition, a session attribute is a string value. However, you can use Advanced mode to convert the string to a numeric type and perform operations on it.
When a session attribute is created, it is automatically assigned an internal index number, which corresponds to the first available slot (0 - 63).
How session attributes are populated
Session attributes are populated by the output values of events. Whenever the populating event is triggered in the session, the event value can be written to a specified session attribute.
- A user-created session attribute may be populated by the output of multiple events.
- Session attribute assignments are managed through the More Options step of the event definition. When the event is triggered, the detected value for the event can populate any of the defined session attributes.
That variable and its value are added to the session object, which means it becomes part of the session data. As soon as the variable is created, it is part of the session, regardless of whether the session is active or completed.
When the session attribute gets populated is determined by the trigger for the populating event. Events can be triggered in the following points of a session:
First Hit of Session
- when the session beginsEvery Hit
- when the hit loadsAfter Every Hit
- when the hit is unloadedLast Hit
- the last hit of the sessionEnd of Session
- when the session closesLast ScreenView of Session
- always holds the URL, or screen view name, of the page that is currently visible.
For example, suppose Event A is triggered on the First Hit of the Session and populates Session Attribute A. When the first hit occurs in an active session, the session attribute and its current value are added to the session object.
- Session attributes are updated at the end of each trigger. They are available at the beginning of the next trigger. For example, if a session attribute is defined to trigger on
After Every Hit
, then it is set at the conclusion of evaluation of each hit, and the new value is available for the next hit, until the value is set again. - In EventEngineScripting, session variables are accessed as a property of the session object (
$S
).
When a search template is configured to include a session attribute as a field, users can search for the existence of the session attribute in all active sessions. The value of the variable may subsequently change.
- Other events that are triggered later in the session can overwrite the value in the session attribute. For example, suppose Event B is triggered on Hit 12 as an
After Every Hit
and changes the value of Session Attribute A. This variable value is now present in the session object. The original value is no longer available, and searches for it do not return the affected session. End of Session
events can be configured to write the final value of the session attribute. This final value is carried forward when the session is moved from the Short Term Canister (active sessions) to the Long Term Canister, where completed sessions are indexed and stored.- For completed session searches, session attributes are stored in the
[CanisterSummary]
section of the request, where they are automatically indexed.
Session attributes populated by system
In the Session Attributes tab, some of the listed attributes are identified as Populated
by System
. These attributes are defined within the Canister and cannot be edited or viewed through the Portal interface. These attributes are provided by Tealeaf and do not count against the 64 session attributes available for your use.
How session attributes are stored
Session attribute values are stored as text data. This method of storage has several implications.
- When specifying search terms, you cannot use comparative operators on session attribute data. A text value for a session attribute cannot be specified as "greater than" another text value, for example.
- By default, in the search interface, characters that are not indexed are removed from the inputs, which includes punctuation such as
,
and.
and$
.Note: For searches of the cxReveal Search database, the submitted query does not perform any modifications for the text-based search. So, the input, which is received from the search interface, is unchanged, meaning that the punctuation that is stripped by the search interface never reappears in the query to enable an exact match of data in the database.
If you must record numeric data in a session attribute:
- Store values as non-negative integers.
- Do not include any punctuation.
- Consider storing values as a range of values in different attributes.
- When performing a search for these values, use the
like
operator.
Uses for session attributes
The session attributes that you define can be used in the following areas of Tealeaf.
Event conditions | Session attributes can be used as conditions to trigger other events. You may configure the test to detect for the presence of the session attribute or for specific values. |
Event values | Session attributes can be used to store event values that persist throughout the session. You may configure the event to populate a session attribute. |
Search Templates | Tealeaf administrators can configure search templates to include fields for searching for the existence of a session attribute or for specific values of a variable. Search templates can be made available to users to help the configuration of search parameters. |
Session List Templates | When a session search runs, the results are displayed in a session list template. You may configure session list templates to display one or more session attributes as columnar fields. |
Search | If the selected Active, Completed, or All Sessions search template includes the session attribute as one of the search fields, you can search for the existence or for specific values of the session attribute.
Note: Depending on the trigger of its populating event, a session attribute may not be available in a search template, even if you configure it. For example, if the session attribute is populated by an event that is triggered by End of Session, it is possible to add the session attribute as a field to an Active search template, even though the field is not yet populated for active sessions. |
Data Export | Through a session list template that was configured to include one or more session attributes, you can export session data for use by third-party tools.
Note: The value reported in the session list template is always the last recorded value in the session. If you need to export all detected values of a session attribute, you must install and deploy cxConnect for Data Analysis. |
Replay | You can replay sessions through the session list. When you have defined and executed a search that includes a session attribute as a criterion for display in a session list template that includes the criterion, you can find and replay a session that includes this value.
During replay, you can identify session attributes in the request. The |
Reporting | Session attributes can be configured to appear in reports after dimensions have been designed to be populated by them. An event must be configured to be triggered based upon the existence of a session attribute and to populate a dimension with its detected value. Then, the dimension can be selected for inclusion in a configured report. |