bsharp / laralytics
Laravel的简单分析工具
v1.0.0-beta.24
2016-04-18 13:40 UTC
Requires
- php: >=5.4.0
- illuminate/support: 5.2.*
- monolog/monolog: ~1.11
- nesbot/carbon: ~1.20
- ramsey/uuid: ^3.0@dev
Requires (Dev)
- mockery/mockery: ~0.9.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~4.0
- dev-master
- v1.0.0-beta.24
- v1.0.0-beta.23
- v1.0.0-beta.22
- v1.0.0-beta.21
- v1.0.0-beta.20
- v1.0.0-beta.19
- v1.0.0-beta.18
- v1.0.0-beta.17
- v1.0.0-beta.16
- v1.0.0-beta.15
- v1.0.0-beta.14
- v1.0.0-beta.13
- v1.0.0-beta.12
- v1.0.0-beta.11
- v1.0.0-beta.10
- v1.0.0-beta.9
- v1.0.0-beta.8
- v1.0.0-beta.7
- v1.0.0-beta.6
- v1.0.0-beta.5
- v1.0.0-beta.4
- v1.0.0-beta.3
- v1.0.0-beta.2
- v1.0.0-beta.1
- dev-analysis-XVo7Vq
- dev-analysis-z9x4mq
This package is not auto-updated.
Last update: 2024-09-24 02:47:23 UTC
README
安装
Composer
要将Laralytics作为Composer包安装,用于与Laravel 5.*一起使用,只需将以下内容添加到您的composer.json文件中
"Bsharp/laralytics": "dev-master"
添加服务提供者
将此行添加到您的config/app.php
文件中的服务提供者数组
Bsharp\Laralytics\LaralyticsServiceProvider::class,
发布
要将所有laralytics资源添加到您的应用中,您需要使用vendor:publish
artisan命令来发布它们
php artisan vendor:publish
您可以使用以下方式逐个指定要发布哪些资源
php artisan vendor:publish --tag=config # Laralytics configuration
php artisan vendor:publish --tag=migrations # Laralytics migrations
php artisan vendor:publish --tag=middleware # (optional) Generic middleware to log your app action
php artisan vendor:publish --tag=eloquent # For eloquent driver only
php artisan vendor:publish --tag=js # For laralytics js file
添加laralytics路由以处理js事件
Route::post('laralytics', '\Bsharp\Laralytics\LaralyticsController@payload');
配置
打开config/laralytics.php
文件,在这里您可以指定
- 与Laralytics一起使用的驱动程序
- 如果使用Eloquent驱动程序,则Eloquent模型路径
- 检索认证用户ID的方法
Laralytics js
使用vendor:publish
artisan命令将Laralytics js添加到您的public目录中
要开始使用Laralytics,请将文件添加到您的视图中
<script async src="{{ asset('js/laralytics.min.js') }}"></script>
最后,在视图中添加此行与这个
<script type="text/javascript">
laralytics.init();
</script>
或者添加到一个js外部文件中
laralytics.init();
如果您想要配置,可以指定这些参数
laralytics.init({
API : your route where you want to collect your data,
Version : If you want to know with A/B testing on which page you are,
Limit : To set a limit when you want to send your data if set to 0 the data will be send when the user close his tab/browser or refresh the page
});