If a user create short url, this package will track the url and store the data in database.
You can install the package via composer:
composer require kaantanis/url-tracker
You can publish and run the migrations and config with:
php artisan install:url-tracker
This is the contents of the published config file:
return [
'prefix' => 'url-tracker', // example.com/url-tracker/QSGHG2
'check-last-visit-minute' => 30 // check last 30 min same user visited this url. if not, increase view count
];
// Send post request to this url with tracked_url parameter
// example.com/url-tracker/generate-url (route name is url-tracker.generate-url)
Http::post(route('url-tracker.generate-url'), [
'tracked_url' => 'https://google.com'
]);
// This return a string url path like this with a unique code
// example.com/url-tracker/QSGHG2
// If any visitor visit this url, user redirect to tracked_url
// and visitor data will be stored in database
// main table
[
'created_by' => auth()->id() ?? null,
'url' => $request->tracked_url,
'placeholder' => $uniqueCode
]
// and log table
[
'url_tracker_table_id' => $urlFound->id,
'ip_address' => request()->ip(),
'user_agent' => request()->userAgent(),
'referer' => request()->headers->get('referer'),
'method' => request()->method(),
]
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.