fhusquinet/laravel-campaign-activity-tracker

Track the activity of your campaigns on your Laravel application

Downloads

4487

Stars

3

Version

v2.2.0

Track the activity of your campaigns on your Laravel application

Latest Version on Packagist Total Downloads

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 [email protected] 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.

fhusquinet

Author

fhusquinet