Looking to hire Laravel developers? Try LaraJobs

laravel-gtag maintained by vitorbizarra

Description
This is my package laravel-gtag
Author
Last update
2026/03/30 04:17 (dev-dependabot/github_actions/dependabot/fetch-metadata-3.0.0)
License
Downloads
392

Comments
comments powered by Disqus

This is my package laravel-gtag

Latest Version on Packagist Software License GitHub Code Style Action Status Total Downloads

An package to easily setup Google GTag in Laravel apps

Installation

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"

Usage

{{-- layout.blade.php --}}
<head>
  @include('gtag::script')
  {{-- ... --}}
</head>

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.