PHPackages                             swvjeff/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. swvjeff/laravel-analytics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

swvjeff/laravel-analytics
=========================

A simple package that allows you to define multiple Google Analytics tracking IDs for your website

v0.0.7(5y ago)129MITPHPPHP ^7.2|^8.0

Since May 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/swvjeff/laravel-analytics)[ Packagist](https://packagist.org/packages/swvjeff/laravel-analytics)[ RSS](/packages/swvjeff-laravel-analytics/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

Add multiple Google Analytics tracking IDs with Laravel
=======================================================

[](#add-multiple-google-analytics-tracking-ids-with-laravel)

[![Latest Version](https://camo.githubusercontent.com/1ff36bc0e478c09e9656d7c377abf9f55fa55c2b293d5700316dad45a8f3dbdb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7377766a6566662f6c61726176656c2d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://github.com/swvjeff/laravel-analytics/releases)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A simple package that allows you to define multiple Google Analytics tracking IDs for your website

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

[](#installation)

This package can be installed using Composer:

```
composer require swvjeff/laravel-analytics
```

Add your primary Analytics Tracking ID to your .env file

```
ANALYTICS_TRACKING_ID="UA-XXXXXXX-X"

```

If you want to add multiple tracking IDs, you can publish the config file of this package with the following command and hard-code the tracking IDs into the `secondary_tracking_ids` array:

```
php artisan vendor:publish --provider="Swvjeff\Analytics\AnalyticsServiceProvider"
```

The following config file will be published in `config/analytics.php`

```
return [
    'tracking_id' => env('ANALYTICS_TRACKING_ID'),

    'secondary_tracking_ids' => []
];
```

Additionally, you can add tracking IDs programmatically by calling `\Analytics::addTrackingId('UA-XXXXXXX-X')`.

Example
-------

[](#example)

Save your primary tracking ID to your .env file, the package will automatically detect it

```
ANALYTICS_TRACKING_ID="UA-9999999-1"

```

Add any additional tracking IDs to

```
use Analytics;

// Add any additional GA tracking IDs programmatically
Analytics::addTrackingId('UA-9999999-2');
Analytics::addTrackingId('UA-9999999-3');
```

Render your Analytics tracking script

```
>

    {!! Analytics::render() !!}

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jeff Smith](https://github.com/swvjeff)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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 ~56 days

Recently: every ~84 days

Total

7

Last Release

1852d ago

PHP version history (3 changes)v0.0.1PHP ^7.1

v0.0.6PHP ^7.2

v0.0.7PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/559092?v=4)[Jeff](/maintainers/swvjeff)[@swvjeff](https://github.com/swvjeff)

---

Top Contributors

[![swvjeff](https://avatars.githubusercontent.com/u/559092?v=4)](https://github.com/swvjeff "swvjeff (12 commits)")

### Embed Badge

![Health badge](/badges/swvjeff-laravel-analytics/health.svg)

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

###  Alternatives

[tightenco/ziggy

Use your Laravel named routes in JavaScript.

4.3k41.6M267](/packages/tightenco-ziggy)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)

PHPackages © 2026

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