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.
You can install the package via composer:
composer require fhusquinet/laravel-campaign-activity-tracker
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');
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email florian.husquinet@deegital.be instead of using the issue tracker.
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!
The MIT License (MIT). Please see License File for more information.