Log service events

IOnReconcileExecutedEvent

This interface is implemented by all events that fire after a user has logged in and is being mapped to the Sitefinity CMS tracking cookie ID. There is only one such built-in event and you must subscribe to the interface rather than the class that implements it.

In the event handler, you can access the following information:

  • UserId – the ID of the user that logged in
  • TrackingId – Sitefinity CMS tracking cookie ID (sf-trckngckie).

Your event handler must look like this:

C#
using System;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Services.Statistics;

namespace SitefinityWebApp
{
   public class Global : System.Web.HttpApplication
   {
       protected void Application_Start(object sender, EventArgs e)
       {
           Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped9;
       }

       private void Bootstrapper_Bootstrapped9(object sender, EventArgs e)
       {
           EventHub.Subscribe<IOnReconcileExecutedEvent>(evt => IOnReconcileExecutedEventHandler(evt));
       }

       public void IOnReconcileExecutedEventHandler(IOnReconcileExecutedEvent eventInfo)
       {
           string userId = eventInfo.UserId;
           string trackingId = eventInfo.TrackingId;
       }
   }
}

IFlushSentencesCompletedEvent

This interface is implemented by all events that fire after the Log service buffer is flushed to the database. There is only one such built-in event and you must subscribe to the interface rather than the class that implements it.

In the event handler, you can access the Items – a list of sentence items that are stored in the database after the Log service buffer flushed

Your event handler must look like this:

C#
using System;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Services.Statistics.Events;

namespace SitefinityWebApp
{
   public class Global : System.Web.HttpApplication
   {
       protected void Application_Start(object sender, EventArgs e)
       {
           Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;
       }

       private void Bootstrapper_Bootstrapped(object sender, EventArgs e)
       {
           EventHub.Subscribe<IFlushSentencesCompletedEvent>(evt => IFlushSentencesCompletedEventHandler(evt));
       }

       public void IFlushSentencesCompletedEventHandler(IFlushSentencesCompletedEvent eventInfo)
       {
           var items = eventInfo.Items;
       }
   }
}
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.