ASP.NET Core 6.0 - Homegrown Analytics Project

The Analytics middleware collects and analyzes the properties of the HttpContext and Request. The middleware creates and stores a new Session if the SessionId cookie is not found. The middleware looks for a known UserAgent and creates and stores a new UserAgent if not found. The middleware creates and stores a new PageHit and updates the NotFound property on 404 Response status.

PageHit pageHit = new(method, path, queryString, refererHeader, userAgentId, sessionId, anonymizedIp, cookieConsent, screenSize, Convert.ToInt32(minutesOffset), userId);

The project is designed and organized to allow easy integration with existing projects. V2 simplifies the process with an Analytics area folder. The analytics schema can be implemented with SQL scripts or EF Core migration. Use the Package Manager Console to execute "update-database -Context AnalyticsDbContext" to apply the InitialSchema migration. SQL scripts are located in the Areas/ Analytics/ Data/ SqlScripts folder. The PurgeExpiredAnalytics script deletes expired related records. The RemoveAnalyticsSchema will remove all analytics and Hangfire data and schema. The EnsureAnalyticsDefaultData HostedService sets the AnalyticsSchema version and creates the required default UserAgent and Session.

V2.1.0 - MIT License - $10 Access Fee - - 9,636,079 bytes



Not accepting new comments.

Submit your comment. Comments are moderated.

User Image
DisplayedName - Member Since ?

Change Log

v2.1.0 - 2022-08-12
-- Implemented ViewDateTime
-- Implemented MaliciousIp entity
-- Implemented MaliciousIp pages
-- Implemented Custom TagHelpers
-- Updated MS NuGet Package@6.0.8
-- Updated AnalyticsSchema@2.1.0
-- Updated AnalyticsUI@2.1.0
-- Updated Chart.js@3.9.1
-- Continuity and bug fixes
v2.0.0 - 2022-08-01
-- Implemented Chart.js@3.8.2
-- Implemented Bootstrap Icons@1.9.1
-- Updated Twitter-Bootstrap@5.2.0
-- Updated dynamic-modals.js@2.0.0
-- Updated AnalyticsSchema@2.0.0
-- Updated MS NuGet Package@6.0.7
-- Updated Hangfire NuGet Package@1.8.0-rc1
-- Updated favicon.ico
-- Added chart pages
-- Continuity and bug fixes
v1.1.0 - 2022-06-12
-- Implemented API filter
-- Updated PageHit
-- Updated MS NuGet Packages@6.0.5
-- Updated Bootstrap-Native@4.2.0
-- Updated AnalyticsSchema@1.3.0
-- Continuity and bug fixes
v1.0.0 - 2021-12-15
-- Migrated From .NET 5.0@1.3.2
-- Implemented Top-Level Statements
-- Implemented Global Usings
-- Implemented File Scoped Namespaces
-- Implemented Analytics Settings
-- Implemented Global DateTime Formats
-- Implemented Global EnableCookieConsent
-- Implemented Revoke Cookie Consent
-- Implemented dynamic-modals.js
-- Updated MS NuGet Packages@6.0.1
-- Updated Bootstrap-Native@4.0.7
-- Updated AnalyticsSchema@1.1.0
-- Updated Must Accept Cookies
-- Updated CheckForUpdate
-- Continuity and bug fixes