orlserg/utm-recorder

Package to track utm attributes from visitors

Downloads

17

Stars

1

Version

v1.0.29

UtmRecorder

UtmRecorder help you record utm parameters from visitors and visited urls.

Documentation

Installation

$ composer require orlserg/utm-recorder

Add the service provider and (optionally) alias to their relative arrays in config/app.php:


    'providers' => [
        ...
        \Orlserg\UtmRecorder\UtmRecorderServiceProvider::class,
    ],

...

    'aliases' => [
        ...
        'UtmRecorder' => \Orlserg\UtmRecorder\UtmRecorderFacade::class,
    ],

Publish the config and migration files:

php artisan vendor:publish --provider="Orlserg\UtmRecorder\UtmRecorderServiceProvider"

Add the \Orlserg\UtmRecorder\Middleware\UtmRecorder::class middleware to App\Http\Kernel.php after the EncryptCookie middleware:

    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \App\Http\Middleware\EncryptCookies::class,
        \Kyranb\Footprints\Middleware\CaptureAttributionDataMiddleware::class,
    ];

Go over the configuration file, and set up settings:

    // your own visitor table
    'link_visits_with' => 'visitors',

    // your own visitor model
    'link_visits_with_model' => \App\Visitor::class,

Run:

$ php artisan migrate

Link your own visitor model with visits table like so:

    public function visits()
    {
        return $this->HasMany(Visit::class, 'owner_id', 'id');
    }
orlserg

Author

orlserg