orlserg / utm-recorder
Package to track utm attributes from visitors
v1.0.29
2018-03-23 08:27 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-05-15 02:08:21 UTC
README
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'); }