I am using Sitecore 8.2. I have a requirement when user initiates webchat through javascript. I need to push all the session details to XDB using an API. I have created the following method in the API to push data to XDB:

public class WidgetsApiController : Controller, IController
        private IGenesysWidgetsSettingsProvider WidgetsSettingsProvider { get; }

        public WidgetsApiController()
            WidgetsSettingsProvider = new GenesysWidgetsSettingsProvider();

        public ActionResult SessionAbort()

            Guid contactId = Tracker.Current.Contact.ContactId;
            ContactManager contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager;
            return Content("ok", "application/json");

I have called the sessionAbort from javascript but I still don't see the Profile appearing in Experience profile. But if I add the following line to the controller function the data is appearing in the profile:


If I do an session abort does that mean that user data would be recorded as a separate interaction after that? Is there a way to be able to push the data and continue using the same interaction?

  • Did you turn on anonymous indexing in xDB?
    – Chris Auer
    Jul 31 '19 at 2:38
  • Yes it is already on. I have lot of anonymous profiles in the experience profile. The profile eventually get shown up but not straight away.
    – Arun Kumar
    Jul 31 '19 at 2:41
  • Great. In your api you just need Session.Abandon(). You don’t need any of the other stuff. Just make sure your api call includes security so you are sending the cookies as well. You need to make sure the sitecore analytics cookie is there. Easy way to tell is if the tracker ID is the same in your api controller as it is in normal controller code.
    – Chris Auer
    Jul 31 '19 at 2:46
  • using session.abandon has any other affects too? I mean does it have any other implication on user profile?
    – Arun Kumar
    Jul 31 '19 at 2:51
  • It just closes the xDB session and writes it to the xDB database. If you close the session and then refresh the site, it starts a new session for the same contact. It’s all tied to the sitecore analytics cookie.
    – Chris Auer
    Jul 31 '19 at 2:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.