定制 lancodev/laravel-analytics 二次开发

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

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

lancodev/laravel-analytics

最新稳定版本:0.7

Composer 安装命令:

composer require lancodev/laravel-analytics

包简介

Laravel Analytics

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a simple way to capture site analytics within your existing Laravel application.

Installation

Install the package via composer:

composer require lancodev/laravel-analytics

Publish the components and views:

php artisan vendor:publish --tag="laravel-analytics-components"
php artisan vendor:publish --tag="analytics-views"

Run the package's install command:

php artisan analytics:install

Usage

Trackable Trait

The package provides an optional Trackable trait that can be used to assign page view analytics to a model. The trait provides a pageViews relationship that can be used to retrieve the page views for the model.

This would typically be implemented by the User model. However, it could also be implemented by any other model that you wish to track page views for.

To use the trait, simply add the following to your model:

namespace App\Models;

use Lancodev\LaravelAnalytics\Traits\Trackable;

class User
{
    use Trackable;
}

Tracking

To begin tracking analytics, add the <x-analytics-analytics /> component to your layout file(s). This will add the necessary JavaScript to your application.

<html>
    <head>
        <title>My Application</title>
    </head>
    <body>
        ``` content ```

        <x-analytics-analytics />
    </body>
</html>

The <x-analytics-analytics /> component accepts the following props:

  • trackable: the morphable entity to track
    • Example: <x-analytics-analytics :trackable="auth()->user()" />
    • This will associate all page view analytics with the current user

Analytics Dashboard

The package also provides a simple dashboard component that can be used to display analytics for your application.

The dashboard can be added to any view by adding the following:

<x-analytics-dashboard />

This will add the following to your page:

analyticsdashboardscreenshot.png

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固