ngiraud/laravel-cookies-analytics
Composer 安装命令:
composer require ngiraud/laravel-cookies-analytics
包简介
Add Google Analytics and cookie consent to your application.
README 文档
README
Installation
- Install the package via composer:
composer require ngiraud/laravel-cookies-analytics
- Install the CookieConsent plugin
yarn add cookieconsent
or
npm install cookieconsent --save
Usage
- You can activate/deactivate cookies and google analytics by settings environment variables in your
.envfile :
GOOGLE_ANALYTICS_ENABLED GOOGLE_ANALYTICS_ID (mandatory if GOOGLE_ANALYTICS_ENABLED is set to true) COOKIES_ENABLED
- Add the view to the top of your
<head>section :
@include('analytics::scripts')
- Add the css for the CookieConsent plugin in your css file :
@import "../../node_modules/cookieconsent/build/cookieconsent.min.css";
- And these lines in your vuejs index file :
import {CookieConsent} from 'cookieconsent'; if (window.cookieSettings.enabled === true) { document.addEventListener('DOMContentLoaded', () => { cookieconsent.initialise(window.cookieSettings.content); }); }
- If you want to customize the popup and the message in the config file, you can publish and edit the config file :
php artisan vendor:publish --tag=analytics-config
Don't forget to generate and include your css & js files.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email contact@ngiraud.me instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 116
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-28