orlserg / utm-recorder
跟踪访客utm属性的包
v1.0.29
2018-03-23 08:27 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-10-02 03:46:54 UTC
README
UtmRecorder 帮助您记录访客和访问的URL中的utm参数。
文档
安装
$ composer require orlserg/utm-recorder
在config/app.php中,将服务提供商和(可选)别名添加到它们的相对数组中
'providers' => [ ... \Orlserg\UtmRecorder\UtmRecorderServiceProvider::class, ], ... 'aliases' => [ ... 'UtmRecorder' => \Orlserg\UtmRecorder\UtmRecorderFacade::class, ],
发布配置和迁移文件
php artisan vendor:publish --provider="Orlserg\UtmRecorder\UtmRecorderServiceProvider"
在App\Http\Kernel.php中,在EncryptCookie中间件之后添加\Orlserg\UtmRecorder\Middleware\UtmRecorder::class中间件
protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \App\Http\Middleware\EncryptCookies::class, \Kyranb\Footprints\Middleware\CaptureAttributionDataMiddleware::class, ];
检查配置文件,并设置设置
// your own visitor table 'link_visits_with' => 'visitors', // your own visitor model 'link_visits_with_model' => \App\Visitor::class,
运行
$ php artisan migrate
将您的访客模型与访问表链接,如下所示
public function visits() { return $this->HasMany(Visit::class, 'owner_id', 'id'); }