Project Description

The Activity Tracking Log is a pluggable component intended to provide user and system activity tracking functions for ASP.Net/MVC applications. Represents a set of HTTP handlers and modules that expose activity analytic reports and client side API. Easy to configure and use.

Features

Current Features Planned Features
Note: planned version could be changed without notice.

Configuration and Usage

Easy to configure and use - add ActivityTrackingLog.dll as a reference to your project, copy default configuraion from sample project, call Log.LogActivity(...) from your page and you are done!

Reference the ActivityTrackingLog.dll assembly in your project

referenced_assembly.png

Copy the default ActivityTrackingLog configuration from here or from the sample project

<configSections>
    <!-- activity tracking log section group -->
    <sectionGroup name="activityTrackingLog">
      <section name="log" requirePermission="false" 
                 type="ActivityTrackingLog.Configuration.ConfigSections.LogConfigSection, ActivityTrackingLog" />
      <section name="storage" requirePermission="false" 
                 type="ActivityTrackingLog.Configuration.ConfigSections.StorageConfigSection, ActivityTrackingLog" />
      <section name="clientSideAccess" requirePermission="false" 
                 type="ActivityTrackingLog.Configuration.ConfigSections.ClientAccessConfigSection, ActivityTrackingLog" />
      <section name="ui" requirePermission="false" 
                 type="ActivityTrackingLog.Configuration.ConfigSections.UiConfigSection, ActivityTrackingLog" />
      <section name="api" requirePermission="false" 
                 type="ActivityTrackingLog.Configuration.ConfigSections.ApiConfigSection, ActivityTrackingLog" />
    </sectionGroup>
  </configSections>
  <!-- activity tracking log settings -->
  <activityTrackingLog>
    <log enabled="true" applicationKey="YourApplicationName" logSystemEvents="true" logSessionEvents="true" 
                            logRequestEvents="true" logAuthEvents="true" logUserAgent="true" />
    <storage enabled="true" type="ActivityTrackingLog.Storage.Implementations.InMemoryRepository, ActivityTrackingLog" 
                            oldestDate="10/10/2011 00:00:00" recordsLimit="10000" connectionString="connection to your database" />
    <clientSideAccess enabled="true" handlerUrl="/ActivityAnalytics/ClientActivitiesHandler.axd"/>
    <ui enabled="true" localOnly="false" />
    <api enabled="true" localOnly="false" />
  </activityTrackingLog>
  <!-- Handlers configuration -->
  <location path="ActivityAnalytics">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
      <!-- this section is used for developmnet server, IIS < 7.0 or IIS >= 7.0 in classic mode -->
      <httpHandlers>
        <add verb="POST,GET,HEAD" path="ActivityAnalyticsUI.axd" type="ActivityTrackingLog.Web.Handlers.AnalyticsUI, ActivityTrackingLog" />
        <add verb="POST,GET,HEAD" path="ActivityAnalyticsApi.axd" type="ActivityTrackingLog.Web.Handlers.AnalyticsApi, ActivityTrackingLog" />
        <add verb="GET" path="ClientSideLogClient.axd" type="ActivityTrackingLog.Web.Handlers.ClientSideLogClient, ActivityTrackingLog" />
        <add verb="POST" path="ClientActivitiesHandler.axd" type="ActivityTrackingLog.Web.Handlers.ClientActivitiesHandler, ActivityTrackingLog" />
      </httpHandlers>
    </system.web>
    <system.webServer>
      <!-- this section is used for IIS >= 7.0 in integrated mode -->
      <handlers>
        <add name="ActivityAnalyticsUI" verb="POST,GET,HEAD" path="ActivityAnalyticsUI.axd"
             type="ActivityTrackingLog.Web.Handlers.AnalyticsUI, ActivityTrackingLog" preCondition="integratedMode" />
        <add name="ActivityAnalyticsApi" verb="POST,GET,HEAD" path="ActivityAnalyticsApi.axd"
             type="ActivityTrackingLog.Web.Handlers.AnalyticsApi, ActivityTrackingLog" preCondition="integratedMode" />
        <add name="ClientSideLogClient" verb="GET" path="ClientSideLogClient.axd"
             type="ActivityTrackingLog.Web.Handlers.ClientSideLogClient, ActivityTrackingLog" preCondition="integratedMode" />
        <add name="ClientActivitiesHandler" verb="POST" path="ClientActivitiesHandler.axd"
             type="ActivityTrackingLog.Web.Handlers.ClientActivitiesHandler, ActivityTrackingLog" preCondition="integratedMode" />
      </handlers>
    </system.webServer>
  </location>
  <!-- Modules Configuration -->
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="SystemEventsLogging" type="ActivityTrackingLog.Web.SystemEventsLoggingModule, ActivityTrackingLog" />
    </modules>
  </system.webServer>

Call the logging function from your page code

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        // log server side activity
        var activityItem = Log.LogActivity("WebPages", "HomePageAccessed");
        if (null != activityItem)
        {
            lblLoggedServerMessage.Text = 
                      string.Format("This page triggered an SERVER side activity [{0}] at {1}", 
                          activity.ToString(), 
                          activityItem.TimeUtc.ToString("MM/dd/yyyy HH:MM:ss.fff"));
         }
    }
}
// 1. This will log all accessed actions with Category = "ProductController" , Activity = "ActionName"
[LogActivity()]
public class ProductController : Controller
{
    ...
    // 2. This will log current action with Category = "ProductController" , Activity = "Index"
    [LogActivity()]
    public ActionResult Index()
    {
        // 3. Static method call
        Log.LogActivity("ProductController", "IndexAccessed");

        return View();
     }
    ...
}

And you are done!
Examples below show out-of-the box analysis UI.

Collected Activities

Sample URL (You need to run the sample project to access it):
http://localhost:54055/ActivityAnalytics/ActivityAnalyticsUI.axd?cols=sequence,timeutc,activitytype,category,activity,userkey,pageurl

browser_window.png

Grouped Activities

Sample URL (You need to run the sample project to access it):
http://localhost:54055/ActivityAnalytics/ActivityAnalyticsUI.axd?entity=ActivityItem&view=page&report=groupedlist&cols=ActivityType,Category,Activity,PageUrl,Count

browser_window_grouped.png

Chart

Coming soon...