Home Articles Packages

web

KruisIT.Web.Analytics

Serverside analytics for ASP.NET MVC.

Install

Install the package per the instructions found at https://www.nuget.org/packages/KruisIT.Web.Analytics/. A class RazorGeneratorMvcStart is added to your App_Start folder, but it is not needed.

Use

To start analysing visits, add the Analytics attribute to your controller. The first param is the name of your connection string, the optional second is the name of your project, which is useful when running multiple projects on the same database.

[KruisIT.Web.Analytics.Attributes.Analytics("YourDb")]
public class SomeController : Controller

[KruisIT.Web.Analytics.Attributes.Analytics("YourDb", "Web")]
public class SomeController : Controller

View

To view reports, create a controller that extends ReportController. The constructor needs the name of your connection string.

public class AnalyticsController
: KruisIT.Web.Analytics.Controllers.ReportController
{ public AnalyticsController() : base("YourDb") { } }

Now you can view the UI at /analytics .