laravel-ga-embed maintained by mmhk
Description
google analytics embed dashboard for laravel
Author
Last update
2019/10/11 09:25
(dev-master)
License
Downloads
5
Laravel google analytics embed dashboard
google analytics embed dashboard for laravel

Install
composer require mmhk/laravel-ga-embed
Config
-
配置
ServiceProviderconfig/app.php
<?php
return [
'providers' => [
//...
MMHK\GA\GoogleAnalyticsEmbedServiceProvider::class,
],
'aliases' => [
//...
'GAEmbed' => MMHK\GA\GAEmbed::class,
],
];
如果是
Laravel 5.5以上版本,直接composer update之后会自动发现ServiceProvider
- 发布相关资源文件
php artisan vendor:publish --provider="MMHK\GA\GoogleAnalyticsEmbedServiceProvider"
- 修改配置
config/ga-embed.php
<?php
return [
'config-file' => base_path('resources/key.json'), //此为 Google API Console中下载的json文件
];
- 使用
<?= GAEmbed::render($view_id); ?>
$view_id为 google analytics 中 Admin -> Account -> Property -> View -> View Settings 中找到。
参考
ref: https://developers.google.com/analytics/devguides/config/mgmt/v3/quickstart/service-php
