fhusquinet / laravel-campaign-activity-tracker
Track the activity of your campaigns on your Laravel application
Requires
- php: ^7.4|^8.0
- illuminate/config: ~5.5.0|~5.6.0|~5.7.0|^6.0|^7.0|^8.0|^9.0
- illuminate/database: ~5.5.0|~5.6.0|~5.7.0|^6.0|^7.0|^8.0|^9.0
- illuminate/support: ~5.5.0|~5.6.0|~5.7.0|^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ~3.5.0|~3.6.0
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-07 19:28:59 UTC
README
If you are managing AdWords or Facebook campaigns using UTM parameters in your URLs this package might be for you! Simply add the TracksCampaignActivity trait on your wanted models and the TrackCampaigns Middleware to your wanted routes and see what impact your campaigns have on your data. It will track the created, updated and deleted event on the models using the TracksCampaignActivity and store the UTM parameters, url and time of visit of each different instance in the database.
Installation
You can install the package via composer:
composer require fhusquinet/laravel-campaign-activity-tracker
Usage
Add the TracksCampaignActivity trait to your wanted models.
// App\Models\Article.php namespace App\Models; use FHusquinet\CampaignActivityTracker\Traits\TracksCampaignActivity; use Illuminate\Database\Eloquent\Model; class Article extends Model { use TracksCampaignActivity
And add the TrackCampaigns middleware to your wanted routes, you can either set it at the global level or on a route basis.
\\ App/Http/Kernel.php /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ // \FHusquinet\CampaignActivityTracker\Middleware\TrackCampaigns::class ],
\\ App/Http/Kernel.php protected $routeMiddleware = [ // 'campaignTracker' => \FHusquinet\CampaignActivityTracker\Middleware\TrackCampaigns::class ]; // routes/web.php Route::get('/')->middleware('campaignTracker');
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email florian.husquinet@deegital.be instead of using the issue tracker.
Thanks
Special thanks to Spatie for their awesome laravel-activitylog package as well as their skeleton-php package for getting me the inspiration and help required for this package!
Credits
License
The MIT License (MIT). Please see License File for more information.