Skip to main content

Sitecore Analytics: DMS 2.0: Persistent Cookies

Sitecore Analytics provides most accurate data as it works on server side. It has lot of tracking variables which can used for analysis.
As part of Sitecore Analytics, certain cookies are set in the web client.

SC_ANALYTICS_GLOBAL_COOKIE
SC_ANALYTICS_SESSION_COOKIE

SC_ANALYTICS_GLOBAL_COOKIE: To identify repeat visits from a single user, Sitecore sends a persistent session cookie to the web client. The name of the persistent session cookie is SC_ANALYTICS_GLOBAL_COOKIE. The persistent session cookie expires 10 years after the last page requested from the solution by the web client.

SC_ANALYTICS_SESSION_COOKIE: To identify a sequence of HTTP requests from a single user, Sitecore sends an Engagement Analytics session cookie to the web client. The name of the session cookie is SC_ANALYTICS_SESSION_COOKIE. One of key feature of Sitecore Analytics Session Cookie is though ASP.NET expires (normally due the sessionState configuration) and creates a new session in the web page, Analytics session will not expire and will not create a new visit. 

AFAIK, this expiration time cannot be changed.

In Sitecore.Analytics.dll (DMS 2.0), the below code snippets add cookies to the client. Expiration time for Global session is for 10 years. 

HttpCookie result = (current == null) ? null : current.Response.Cookies["SC_ANALYTICS_GLOBAL_COOKIE"];
if (result == null)
{
       result = new HttpCookie("SC_ANALYTICS_GLOBAL_COOKIE");
this.AddCookie(result);
}
result.Value = this.VisitorId.ToString("N");
result.Path = "/";
result.Expires = this.IsInvalid ? DateTime.UtcNow.AddDays(-1.0) : DateTime.UtcNow.AddYears(10);

In the client, 

Set-Cookie: SC_ANALYTICS_GLOBAL_COOKIE=f80224a049a94a23a6a66c5c81639e13; expires=Mon, 01-Nov-2023 20:02:52 GMT; path=/; HttpOnly
Set-Cookie: SC_ANALYTICS_SESSION_COOKIE=BEAC5C6ADBE44D9E84056B4A8C019C46|1|3i11wfogrb2aqp1h2oj5cpwr; path=/; HttpOnly

Popular posts from this blog

How to use SecurityDisabler and UserSwitcher in Sitecore v6.5 – 6

If current context user doesn’t have permission to access this item, Sitecore will return null or throw exception. 
Note: It is recommended to provide context user with appropriate rights than using SecurityDisabler or UserSwitcher.SecurityDisabler:  !SecurityDisabler will elevate the context user to have administrative privilegeand so context user will be able to do anythingon the system.new Sitecore.SecurityModel.SecurityDisabler();UserSwitcher:UserSwitcher allows a segment of code to run under a specific user instead of current context user. new Sitecore.Security.Accounts.UserSwitcher(Sitecore.Security.Accounts.User.FromName("username",false));Sample Code        ///<summary>/// Code snippets explaining SecurityDisabler and UserSwitcher///</summary>privatevoid SecuritySample()        {//Getting Master Database            Sitecore.Data.Database masterDB = Sitecore.Configuration.Factory.GetDatabase("master");//Getting a Sitecore Item            Sitecore.…

How to access Sitecore Items in Code Behind (Sitecore v6.5) – 4

To get a Sitecore Content Item, use Sitecore.Data.Database.GetItem(Path)
­Sitecore Content Item Class: Sitecore.Data.Items.Item(Get Sitecore Item from “/sitecore/content/Home/myItem”)Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");Sitecore.Data.Items.Item myItem = master.GetItem("/sitecore/content/Home/myItem");If item does not exist or current context user doesn’t have permission to access this item, Sitecore will return null or throw exception. Case is Insensitive while using path to get the items.To get a Sitecore Template Item, use Sitecore.Data.Database.GetTemplate(ID)­Sitecore Template Item Class: Sitecore.Data.Items.TemplateItem(Get Template Item: Folder Template)Sitecore.Data.Items.TemplateItem item = master.GetTemplate(Sitecore.TemplateIDs.Folder);To get a Sitecore Media Item, use Sitecore.Data.Database.GetItem(Path)­Sitecore Media Item Class: Sitecore.Data.Items.MediaItem(Get Media Item from “/sitecore/content/Media Lib…

How to enable Single Sign On in Sitecore with Active Directory Users and Roles

(Assuming that reader has knowledge on Single Sign On)

Single sign on functionality needs the site not to be in anonymous authentication. In IIS, Basic or Windows authentication should be enabled.
How to enable windows authentication in IIS?
Single sign on functionality comes along with Active Directory Module from Sitecore. You can get the latest version from SDN. This module integrates AD to the Sitecore instance. This module needs the LDAP path and few provider configuration settings in web.config file.
SDN Link: http://sdn.sitecore.net/Products/AD/Download.aspx
This module installs LDAP dll, configuration and few aspx pages. Once installed, we get the LDAP login page under /website/Sitecore/admin/ldaplogin.aspx. Along with that, we will be having few more roles in Sitecore.
sitecore\Sitecore Client Account Managing sitecore\Sitecore Client Authoring sitecore\Sitecore Client Configuring sitecore\Sitecore Client Designing sitecore\Sitecore Client Developing sitecore\Sitecore Client Forms Autho…