dangquangha/request-logging

Count and report how many times a bot visit your website

dev-master 2022-03-25 16:50 UTC

This package is auto-updated.

Last update: 2024-04-25 21:29:13 UTC


README

This package allow you to track the following information:

  • How many times do bots visit?
  • How many time do users search or go to page search?
  • How many times do users visit your website through Google or CocCoc?

Installation

In your project folder, run

composer require dangquangha/request-logging

Aftef finish, publish vendor by this command:

php artisan vendor:publish --provider="Workable\RequestLogging\RequestLoggingServiceProvider"

and php artisan migrate to run migration file

Usage Instructions

This package works by using a middleware, logging every request performed by bots in a log file, you can rename the middleware in config/robots_counter.php file.

If you want the middleware works for every request, just put its class \Workable\RequestLogging\Middleware\RobotsCounterMiddleware::class in array $middleware in app/Http/Kernel.php But the best practise is using this middleware for routes need reporting for better performance. Also, you can config your accepted request methods you want to be in your log.

If you want to export the obtained information to the database, you can run the following commands:

To report robots visited times:

php artisan robot:report --date=today

To report users searched times:

php artisan user-search:report --date=today

To report users visit your website through Google or CocCoc:

php artisan refer:report --date=today 

I support some another options

--date=today

--date=yesterday

--date=week

--date=month

--date=range --start=YYYY-MM-DD --end=YYYY-MM-DD