An package to easily setup Google GTag in Laravel apps
You can install the package via composer:
composer require vitorbizarra/laravel-gtag
You can publish the config file with:
php artisan vendor:publish --tag="laravel-gtag-config"
This is the contents of the published config file:
return [
/*
* The Google Analytics id, should be a code that looks something like "G-xxxx".
*/
'id' => env('GTAG_ID', ''),
/*
* Enable or disable script rendering. Useful for local development.
*/
'enabled' => env('GTAG_ENABLED', true),
/*
* Configures the Google Analytics script domain.
*/
'domain' => env('GTAG_DOMAIN', 'www.googletagmanager.com'),
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel-gtag-views"
{{-- layout.blade.php --}}
<head>
@include('gtag::script')
{{-- ... --}}
</head>
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.