adgyn/simple-analytics-laravel
最新稳定版本:1.0.0
Composer 安装命令:
composer require adgyn/simple-analytics-laravel
包简介
Focused on creating analyses for decision-making.
README 文档
README
- PHP 8.2 or later
- Laravel 11.x or later
Installation
Pull this package in through Composer.
composer require adgyn/simple-analytics-laravel
Publish the package settings.
php artisan vendor:publish --tag=simple-analytics
Run laravel migrations.
php artisan migrate
Usage
After installing the package, it will make 2 routes available in your project:
Create a new event from a front-end request.
POST /analytics/event
Body Parameters:
| Field | Description | Required | Default |
|---|---|---|---|
| event_name | Name of event | Yes | - |
| event_label | Label of event | Yes | - |
| route | Frontend route to analytics | Yes | - |
| reference | Reference to filter Ex: parameter of route | No | NULL |
Get analytics generated of events created.
GET /analytics/data
Query Parameters:
| Field | Description | Required | Format | Default |
|---|---|---|---|---|
| start_at | Start date to filter | No | Y-m-d H:i:s | - |
| finish_at | Finish date to filter | No | Y-m-d H:i:s | - |
| detailed | Returns detailed data by route, country, etc. | No | Boolean | false |
| routes | List of routes to filter by | No | Array | [] |
| reference | List of references to filter by | No | Array | [] |
| countries | List of countries codes to filter by. EX: BR | No | Array | [] |
Example response (Detailed: false):
{
"unique_visitors": 4,
"visitors": 8,
"countries": 1,
"events": 3,
"routes": 3
}
Example response (Detailed: true):
{
"routes": [
{
"route": "\/dashboard",
"unique_visitors": 1,
"visitors": 1
},
{
"route": "\/dashboard\/payment",
"unique_visitors": 3,
"visitors": 5
},
{
"route": "\/dashboard\/test",
"unique_visitors": 1,
"visitors": 2
}
],
"countries": [
{
"country": "Not found",
"unique_visitors": 4,
"visitors": 8
}
],
"events": [
{
"event": "On Click",
"unique_visitors": 1,
"visitors": 1
},
{
"event": "Event Test",
"unique_visitors": 1,
"visitors": 1
},
{
"event": "Click on payment button",
"unique_visitors": 3,
"visitors": 6
}
]
}
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-06