Skip to content

ignatandrei/RecordVisitors

Repository files navigation

Record Latest visitors for .NET Core

GitHub license
BuildAndTest codecov Nuget Docs Quality Gate Status

All Contributors

What it does

This project helps you to record what visitors have you on the site. It does not enforce authentication

You can see the latest 5 minutes visitors by browsing to /recordVisitors/AllVisitors5Min or /recordVisitors/AllVisitors/5

How to use it

Simple use

In Startup,

public void ConfigureServices(IServiceCollection services)
{
    //code omitted
    services.AddRecordVisitorsDefault();
    
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    //code omitted 
    app.UseAuthentication();
    //put AFTER authentication
    app.UseRecordVisitors();
    //not necessary
    app.UseAuthorization();
    //code omitted
    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
        endpoints.UseVisitors();
    });


}

Then browse to /recordVisitors/AllVisitors5Min or /recordVisitors/AllVisitors/5

You can see also the history for the URL that the user have browsed : goto /recordVisitors/UserHistory/{userId}/{dateFrom:datetime:regex(\d{{4}}-\d{{2}}-\d{{2}})}/{dateTo?}

( to find the user id , you can also goto /recordVisitors/GetUserId/{userName})

You can see also the classes documentation at https://ignatandrei.github.io/RecordVisitors/RecordVisitors/

Customizable uses

There are several interfaces that you can implement via DI

Name Description
IRecordVisitorFunctions how to indentify the user
IRequestRecorded request of the user
IUserRecorded the user recorded interface to store data
IUsersRepository the connection to the storage( database, csv , others)

The project comes with his implementation - however, you can add yours.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Andrei Ignat

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Also, thanks to the people that made this possible by created frameworks and libraries - see the list here

https://github.com/ignatandrei/RecordVisitors/blob/main/src/RecordVisitors/thanks.md

Links

Licence

The code in this project is licensed under MIT license. You can find the licences for the packages used at https://github.com/ignatandrei/RecordVisitors/blob/main/src/RecordVisitors/licenses.txt