https://github.com/vitorbizarra/laravel-gtag
An package to easily setup Google gtag in Laravel apps
https://github.com/vitorbizarra/laravel-gtag
analytics composer google google-analytics laravel laravel-package packagist spatie
Last synced: 6 months ago
JSON representation
An package to easily setup Google gtag in Laravel apps
- Host: GitHub
- URL: https://github.com/vitorbizarra/laravel-gtag
- Owner: vitorbizarra
- License: mit
- Created: 2024-05-07T00:48:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T02:32:23.000Z (8 months ago)
- Last Synced: 2025-03-30T18:22:29.396Z (7 months ago)
- Topics: analytics, composer, google, google-analytics, laravel, laravel-package, packagist, spatie
- Language: PHP
- Homepage: https://packagist.org/packages/vitorbizarra/laravel-gtag
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# This is my package laravel-gtag
[](https://packagist.org/packages/vitorbizarra/laravel-gtag)
[](LICENSE.md)
[](https://github.com/vitorbizarra/laravel-gtag/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/vitorbizarra/laravel-gtag)An package to easily setup Google GTag in Laravel apps
## Installation
You can install the package via composer:
```bash
composer require vitorbizarra/laravel-gtag
```You can publish the config file with:
```bash
php artisan vendor:publish --tag="laravel-gtag-config"
```This is the contents of the published config file:
```php
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
```bash
php artisan vendor:publish --tag="laravel-gtag-views"
```## Usage
```html
{{-- layout.blade.php --}}@include('gtag::script')
{{-- ... --}}```
## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Vitor Bizarra](https://github.com/vitorbizarra)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.