PHPackages                             quadcompanies/google-analytics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. quadcompanies/google-analytics

ActiveLibrary[API Development](/categories/api)

quadcompanies/google-analytics
==============================

A simple Laravel package to integrate Google Analytics gtag.js

v1.1.0(3mo ago)029↓33.3%MITPHPPHP ^8.1

Since Jan 28Pushed 3mo agoCompare

[ Source](https://github.com/quadcompanies/google-analytics)[ Packagist](https://packagist.org/packages/quadcompanies/google-analytics)[ RSS](/packages/quadcompanies-google-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

Laravel Google Analytics
========================

[](#laravel-google-analytics)

A simple and easy-to-use Laravel package for integrating Google Analytics (gtag.js) into your application.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require quadcompanies/google-analytics
```

```
php artisan vendor:publish --provider="QuadCompanies\GoogleAnalytics\GoogleAnalyticsServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    /*
     * The Google Analytics Measurement ID (usually starts with 'G-')
     */
    'measurement_id' => env('GOOGLE_ANALYTICS_MEASUREMENT_ID'),

    /*
     * Whether or not to enable Google Analytics.
     */
    'enabled' => env('GOOGLE_ANALYTICS_ENABLED', true),

    /*
     * Additional Tag IDs that should be loaded.
     */
    'tag_ids' => [],
];
```

Usage
-----

[](#usage)

### Environment Setup

[](#environment-setup)

Add your Google Analytics Measurement ID to your `.env` file:

```
GOOGLE_ANALYTICS_MEASUREMENT_ID=G-XXXXXXXXXX
```

### Blade Directive

[](#blade-directive)

To add the Google Analytics script to every page, add the `@googleAnalytics` directive to the `` section of your main layout file (e.g., `resources/views/layouts/app.blade.php`):

```
>

    @googleAnalytics()
    ...

...

```

### Dynamic Parameters

[](#dynamic-parameters)

You can also pass a custom measurement ID and additional tag IDs directly through the directive:

```
@googleAnalytics('G-CUSTOM-ID', ['G-TAG-1', 'G-TAG-2'])
```

Testing
-------

[](#testing)

Coming soon...

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

4

Last Release

96d ago

Major Versions

v0.9 → v1.0.02026-02-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/03b1b891d07fd5b88e5d619929fb6c28f5290f7ea33681cd35a6e8f54b91d96f?d=identicon)[hanssignature](/maintainers/hanssignature)

---

Top Contributors

[![hanssignature](https://avatars.githubusercontent.com/u/84735568?v=4)](https://github.com/hanssignature "hanssignature (5 commits)")

### Embed Badge

![Health badge](/badges/quadcompanies-google-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/quadcompanies-google-analytics/health.svg)](https://phpackages.com/packages/quadcompanies-google-analytics)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
