5

In a Sitecore 8.1 Update 3, we have configured the mongodb for shared session state into "Session" collection, and analytics is configured separately into its own collection as well. The code is configured to preserve obtained location data into a custom facet. That data is recalled between browser sessions to allow the site visitor (anonymously) to recall its location settings. I have confirmed that rebooting iis site, the SC_Analytics_Global_Cookie value is preserved, and the facet is deserialized and location data is accessible. However, after about 20min or so, of inactivity (closing browser) the value of the cookie still stays the same, but I no longer see the location data.

Is there an expiration set up for "unidentified" contact within Sitecore?

Here is the code i use to recall the Location data. IGeoTracker is a child interface of the IFacet.

ITracker current = Tracker.Current;
if (((current == null) || !current.IsActive) || (current.Contact == null))
{
   SetLocationUnknown();
}
else
{
   IGeoTracker facet = current.Contact.GetFacet<IGeoTracker>(this._geoTrackerFacetName);
   if (!String.IsNullOrEmpty(facet.FormatedAddress))
   {
      string formatedAddress = facet.FormatedAddress;
      SetLocationKnown(formatedAddress);
 ...
   }
   else
   {
      SetLocationUnknown();
   }
}

Update

I have been doing a bit of reverse engineering with dotPeek tool, and deduced that the ShareSessionStateManger is designed to be 1 minute longer than a private session state timeout which is defined in the web config. Either way the shared session state store is not designed to persist the contact data indefinitely.
Per further research, the contact data must make it back into the Analytics database. That's when I validated that Contact is not being written back into the Analytics Collection. The default Sitecore configuration actually uses a stub contact repository class which prevents the persistence of analytics data. To enable that, we must deploy the configuration in Sitecore.Analytics.Tracking.Database.config

<sitecore>
  <pipelines>   
   <commitSession>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.CheckPreconditions, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateGeoIpData, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.EnsureClassification, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateContactBehaviorProfiles, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.Robots, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.IgnoreVisitsWithoutPages, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateContactSaveMode, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.SubmitSession, Sitecore.Analytics" >
      <SessionContextManager ref="tracking/sessionContextManager" />
    </processor>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.ProcessSubscriptions, Sitecore.Analytics"/>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.ReleaseSharedSession, Sitecore.Analytics" runIfAborted="true"/>
  </commitSession>

  <postSessionEnd>
    <processor type="Sitecore.Analytics.Pipelines.PostSessionEnd.CommitSession, Sitecore.Analytics" />
  </postSessionEnd>

  <submitSessionContext>
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveDevice, Sitecore.Analytics" patch:before="*" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveClassificationsMap, Sitecore.Analytics" patch:after="*[1]" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveVisit, Sitecore.Analytics" patch:after="*[2]" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.RenumberInteractions, Sitecore.Analytics" patch:after="processor[@type='Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveVisit, Sitecore.Analytics']" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.UpdateKeyBehaviorCache, Sitecore.Analytics" patch:after="processor[@type='Sitecore.Analytics.Pipelines.SubmitSessionContext.RenumberVisitIndexes, Sitecore.Analytics']" >
      <ContactManager ref="tracking/contactManager" />
    </processor>
  </submitSessionContext>

</pipelines>

<submitQueue>
  <backgroundService type="Sitecore.Analytics.SubmitQueueService, Sitecore.Analytics">
    <!-- Service wakeup interval in seconds. -->
    <Interval>60</Interval>
  </backgroundService>
</submitQueue>

 <tracking>
   <contactManager type="Sitecore.Analytics.Tracking.ContactManager, Sitecore.Analytics" singleInstance="true">
    <param desc="sharedSessionStateManager" ref="tracking/sharedSessionState/manager" />
    <param desc="contactRepository">
      <patch:delete />
    </param>
   </contactManager>
  </tracking>
</sitecore>
11
  • Can you verify that the contact ID remains the same from session to session. And that the geoTracker data is in the Contact table, in Mongo. When the user rejoins the site after 20 minutes (session timeout), the contact is reloaded from Mongo, in the tracker.
    – Chris Auer
    Oct 6, 2017 at 20:00
  • @ChrisAuer The Contact ID in the cookie is the same. Mongodb data in the shared session state is serialized as a binary object thus i cannot validate the location details in the facet there but i do see the entry under the same id/shared. I do not see any entries under Analytics/Contacts table though. My understanding is that the visitor is never identified for some reason. I do have sc:VisitorIdentification on my layout.
    – Roman
    Oct 6, 2017 at 20:28
  • 1
    The Faceted data is saved to and read from the Contacts collection in the Sitecore Analytics Mongo database. Your issue wont be the session DB. It will be if the data is not being written to Mongo. Is IGeoTracker a custom class you built or is that a Sitecore class?
    – Chris Auer
    Oct 6, 2017 at 21:12
  • 1
    give this video a quick look. I hope it helps explain what I think is wrong. screencast.com/t/s7m2O6NMyQ
    – Chris Auer
    Oct 6, 2017 at 21:23
  • 1
    I had the same issue a while ago. Hopefully this helps. sitecore.stackexchange.com/questions/3186/…
    – Chris Auer
    Oct 9, 2017 at 19:46

1 Answer 1

1

I have been doing a bit of reverse engineering with dotPeek tool, and deduced that the ShareSessionStateManger is designed to be 1 minute longer than a private session state timeout which is defined in the web config. Either way the shared session state store is not designed to persist the contact data indefinitely.
Per further research, the contact data must make it back into the Analytics database. That's when I validated that Contact is not being written back into the Analytics Collection. The default Sitecore configuration actually uses a stub contact repository class which prevents the persistence of analytics data. To enable that, we must deploy the configuration in Sitecore.Analytics.Tracking.Database.config

<sitecore>
  <pipelines>   
   <commitSession>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.CheckPreconditions, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateGeoIpData, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.EnsureClassification, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateContactBehaviorProfiles, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.Robots, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.IgnoreVisitsWithoutPages, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateContactSaveMode, Sitecore.Analytics" />
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.SubmitSession, Sitecore.Analytics" >
      <SessionContextManager ref="tracking/sessionContextManager" />
    </processor>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.ProcessSubscriptions, Sitecore.Analytics"/>
    <processor type="Sitecore.Analytics.Pipelines.CommitSession.ReleaseSharedSession, Sitecore.Analytics" runIfAborted="true"/>
  </commitSession>

  <postSessionEnd>
    <processor type="Sitecore.Analytics.Pipelines.PostSessionEnd.CommitSession, Sitecore.Analytics" />
  </postSessionEnd>

  <submitSessionContext>
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveDevice, Sitecore.Analytics" patch:before="*" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveClassificationsMap, Sitecore.Analytics" patch:after="*[1]" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveVisit, Sitecore.Analytics" patch:after="*[2]" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.RenumberInteractions, Sitecore.Analytics" patch:after="processor[@type='Sitecore.Analytics.Pipelines.SubmitSessionContext.SaveVisit, Sitecore.Analytics']" />
    <processor type="Sitecore.Analytics.Pipelines.SubmitSessionContext.UpdateKeyBehaviorCache, Sitecore.Analytics" patch:after="processor[@type='Sitecore.Analytics.Pipelines.SubmitSessionContext.RenumberVisitIndexes, Sitecore.Analytics']" >
      <ContactManager ref="tracking/contactManager" />
    </processor>
  </submitSessionContext>

</pipelines>

<submitQueue>
  <backgroundService type="Sitecore.Analytics.SubmitQueueService, Sitecore.Analytics">
    <!-- Service wakeup interval in seconds. -->
    <Interval>60</Interval>
  </backgroundService>
</submitQueue>

 <tracking>
   <contactManager type="Sitecore.Analytics.Tracking.ContactManager, Sitecore.Analytics" singleInstance="true">
    <param desc="sharedSessionStateManager" ref="tracking/sharedSessionState/manager" />
    <param desc="contactRepository">
      <patch:delete />
    </param>
   </contactManager>
  </tracking>
</sitecore>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.