Sitecore User Group: Session State and Sitecore xDB
-
Upload
nonlinear-creations -
Category
Data & Analytics
-
view
75 -
download
2
Transcript of Sitecore User Group: Session State and Sitecore xDB
Confidential. All rights reserved. Valtech Solutions, Inc.
Session StateAnd
Sitecore xDBv.1.0
00. Purpose
01. What is Session State?
02. Importance of Session
State in Sitecore xDB
03. Sitecore xDB session
state types
Agenda
04. Consequences of incorrect
session state configuration
05. Configuration Guidelines
and Best Practices
06. Q&A
Purpose00
Consumers demand a single connected experience across multiple devices, whether they’re browsing from a desktop
computer, or searching from their mobile device.
Sitecore makes this consumer experience seamless
• Achieve accurate behavior
tracking using Sitecore xDB
and Session State.
• Enhance and optimize
customer experience based on
collected tracking information.
Let’s get started_
How can one…
What is Session State?
01
11/29/2017 7
Session state
What is a Session State?
• HTTP is a stateless protocol. Client and server do not save user information during multiple requests. Due to this
nature of the protocol, neither the client nor the browser can retain information between different request across the
web pages.
• Some web applications may have to track the user's progress from page to page
• ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in
a Web application.
• Additional data can be added into session state as one makes requests
For example: If I use my name to fill in a form, the application might store that as a session state value.
11/29/2017 8
Session state
How is a Session State stored?
‘in-proc’
• In process (InProc) is the default session state provider that comes with the Microsoft .NET
Framework.
• stores session state in memory on the Web server.
‘out-proc’
• Out of process (OutProc) session state means that you use an external ASP.NET session state
provider such as MongoDB or SQL Server.
• You can also use any custom provider that supports the Session_End event.
Importance of Session State in
Sitecore xDB
02
11/29/2017 10
Sitecore xDB and Session State
• Every time a visitor (contact) makes a request, such as triggering a campaign or a goal this information is
held in session state until the end of session, before making its way to the collection database.
• Session state is a way of identifying visitors (contacts) on your website by assigning them a unique session
ID and by using cookies.
• xDB makes one trip at the start of a session to identify the contact and a second at the end to save all the
session data back to the collection database.
This means fewer server trips are needed to write data back and forth to the collection database.
11/29/2017 11
Sitecore xDB and Session State
Example 1: With xDB; it is possible to track two simultaneous contact sessions from two different
devices, such as from a desktop web browser or a mobile phone.
Example 2: With xDB; in a multi-content delivery cluster environment, you can share contact information
between content delivery instances to ensure that contacts stay connected to the particular cluster
where their interaction originated.
Tracking the session state of your contacts is important regardless of whether you install a standalone environment or a fully scalable environment.
Sitecore xDBsession state
types
03
11/29/2017 13
Sitecore xDB Session State Types
In Sitecore xDB, there are two types of session states:
• Private
• Shared
11/29/2017 14
PRIVATE Session State
• Private session state contains information about the interaction – such as pages visited and goals triggered on that device
• In private session state (ASP.NET), all analytics session data related to a specific interaction is collected and saved to the session state server.
Sitecore xDB Session State Types
11/29/2017 15
PRIVATE Session State
• The default provider is the in process (inProc) session provider which uses session state stored in-memory. This is suitable for small, standalone installations used for test or development purposes.
When you install Sitecore locally, private and shared session state are set to ‘in-proc’. Private
session state is configured where you would configure regular old ASP.NET session state –
in web.config.
Sitecore xDB Session State Types
11/29/2017 16
SHARED Session State
• Shared session state data includes all data that is unique to a contact and that can be shared across simultaneous sessions, such as contact details, devices and engagement automation states triggered.
• Contact data is collected and stored in a dedicated Shared session state store
• This information needs to remain accessible to other concurrent operations, for example, interactions and background processes, and can be shared across multiple sessions
Shared session state is configured in Sitecore.Analytics.Tracking.config.
Sitecore xDB Session State Types
11/29/2017 17
SHARED Session State
• This distinction (shared vs private) is required to support a single contact with two concurrent sessions on two different devices.
Scenario:You might start browsing a website on your laptop and continue on your phone whilst the laptop session is still ongoing . What happens if you moved to a different engagement plan state during the laptop session, or update the e-mail address that is stored in xDB? The laptop session is still ongoing, so those changes have not made it to the collection database yet.
This is where shared session state comes in. Contact data needs to be shared across multiple device sessions, and is therefore stored in shared session state.
Sitecore xDB Session State Types
Consequences of incorrect session
state configuration
04
11/29/2017 19
Sitecore xDB and Session State
Laptop
Server
• I visit a website from my laptop and log in.
• My login details happen to be my unique identifier in the xDB, and it loads my contact information from the collection database.
• This website is backed by three content delivery servers – my session sticks to content delivery server #1 and will stay there for the duration of my session.
• Session state data is managed In-Proc; private and shared session state data is written to memory.
So far, so good.
Scenario: In-Proc session state across multiple CD nodes
Session XAttached to CD #1
Server
Server
11/29/2017 20
Sitecore xDB and Session State
Laptop
Server
Consequences: of not using Out-Proc session state across multiple CD nodes
Session XAttached to CD #1
Server
Server
• I abandon my laptop and switch to my workstation – I log in, am identified a second time, and a new session “Y” starts.
• If my workstation session sticks to a different content delivery server, Sitecore has no way of knowing what is happening to my contact data on content delivery server #1 – because it has no way of accessing the memory (and therefore the shared session data) of another machine.
Workstation
Session YAttached to CD #2
11/29/2017 21
Sitecore xDB and Session State
Conclusion
• Configuring session state is particularly important if you have deployed a multiserver, fully scalable environment with clusters of content delivery or processing servers.
• If you are using the xDB and you have more than one content delivery server per cluster, you MUST USE OUT-PROC SESSION STATE.
• In-Proc is not an option.
• This is all because of the need to support the sharing of session state information for a contact with two concurrent session on different devices.
11/29/2017 22
Sitecore xDB and Session State
Session Lifetime (Shared)The following graph shows the lifetime of the sessions for a single contact and two concurrent interactions made from two different devices.
In this case, shared session state is still useful for handling concurrent visits by the same contact from different devices
Configuration Guidelines and Best Practices
05
11/29/2017 24
Configuration Guidelines and Best Practices
• Depending on which database system you want to use when you configure your session state database, you need to use a session state provider.
Sitecore comes with the following providers:• Sitecore ASP.NET Session State Provider for MongoDB• Sitecore ASP.NET Session State Provider for Microsoft SQL Server
• They also support the session end event that is required by the xDB to track website visits reliably.
• On content delivery servers, private session state must support the Session_End event but this is not required on content management servers.
• On content delivery servers shared session state must support the SessionEnd event. On content management servers shared session state is not supported.
11/29/2017 25
Configuration Guidelines and Best Practices
• Achieve accurate behavior
tracking using Sitecore xDB
and Session State.
• Enhance and optimize
customer experience based on
collected tracking information.
Configuration Guidelines and Best Practices
Q & A
06
11/29/2017 28
References
• https://doc.sitecore.net/sitecore_experience_platform/81/setting_up_and_maintaining/xdb Session state Section
• https://doc.sitecore.net/sitecore_experience_platform/81/setting_up_and_maintaining/xdb/session_state/session_state
valtech.com
where experiences are engineered
Session State
And
Sitecore xDB
987 Wellington St W., Suite 201
Ottawa, ON K1Y 2Y1 Harpreet Rana, PMP, ITIL
Senior Development Manager
Email: [email protected]
Thank You!
Twitter: @DigitalTech4u