1. Go to this page and download the library: Download ismail1k/laravel-analytics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Tracker;
class HomeController extends Controller
{
public function index(Request $request){
Tracker::log($request);
return view('welcome');
}
}
$sessions = Tracker::sessions(60*24); //sessions for last 24H
//Note: $sessions contain: IP, user, Location, Device, Browser, Traffic...
$traffic = Tracker::traffic(60*24); //traffics for last 24H