定制 nanuc/laravel-track 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nanuc/laravel-track

Composer 安装命令:

composer require nanuc/laravel-track

包简介

README 文档

README

This package adds content marketing tracking and A/B tests to your app. The package tries to find a balance between privacy and useful data. All users will be anonymized, so by default there is no way to trace back a user.

Every user receives a random string which is stored in a cookie to identify them on the following visits.

Installation

composer require nanuc/laravel-track

Publish config (optional)

php artisan vendor:publish --provider="Nanuc\LaravelTrack\LaravelTrackServiceProvider" --tag=config

You can configure a separate database connection.

Run migrations

Run php artisan migrate to create the necessary tables.

Usage

Middleware

Just add the middleware track to the routes you want to track.

UTM

The package tracks the utm_campaign and utm_source query parameters. Nothing you need to do here.

Goals

Set reached goals with Tracker::goal('goalName');. You don't need to define the goals - they will be created on the first use.

If the route where you attach a goal is not tracked (e.g. in Livewire routes) the goal will be attached to the last known page view for this visitor.

Goals in views

You can set goals in views too. They will be reached when the place where the component was placed gets visible in the view port. This can be used e.g. to measure if an A/B tested heroshot gets scrolls further down the page.

Just use <track::goal goal="goalName" /> in your blade view. For this to work you need to have a stack scripts in your layout - the name can be configured (laravel-track.goals.component.stack-name).

Page name

As Laravel Livewire uses the same routes for different actions it might be useful to give a page a name. You can do this with Tracker::page('pageName');.

A/B tests

Use the following syntax in your blade views:

@ab('logo', 'blue')
    <img src="logo-blue"/>
@endab
@ab('logo', 'green')
    <img src="logo-green"/>
@endab
@ab('logo', 'red')
    <img src="logo-red"/>
@endab

You don't need to define the A/B tests' name and options - they will be created on the first use. Options will be rotated on each visit.

Dashboard

This package offers a module for LaravelAdmin. To use it make sure to install LaravelAdmin first. Afterwards add \Nanuc\LaravelTrack\LaravelAdmin\LaravelAdmin::class to config/laravel-admin:

'modules' => [
    ...
    \Nanuc\LaravelTrack\LaravelAdmin\LaravelAdmin::class,
]

统计信息

  • 总下载量: 66
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固