PHPackages                             stelianandrei/laravel-server-side-ga - 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. stelianandrei/laravel-server-side-ga

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

stelianandrei/laravel-server-side-ga
====================================

A simple Laravel package that allows the sending of Google Analytics events from the server side

1.0.0(7y ago)11.3kMITPHPPHP ^7.0.0

Since Jun 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/StelianAndrei/laravel-server-side-ga)[ Packagist](https://packagist.org/packages/stelianandrei/laravel-server-side-ga)[ Docs](https://github.com/StelianAndrei/laravel-server-side-ga)[ RSS](/packages/stelianandrei-laravel-server-side-ga/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (6)Used By (0)

Laravel Server Side Google Analytics
====================================

[](#laravel-server-side-google-analytics)

This is a simple package that allows you to track Google Analytics page views and events from your Laravel application.

It was created because I needed a simple way to track these when certain actions occured server-side or when specific actions were triggered from the frontend and I din't want to mingle the JavaScript logic with the tracking part.

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

[](#installation)

First thing you need to do is require the package using composer.

```
composer require stelianandrei/laravel-server-side-ga

```

Then you need to add the service provider to your `config/app.php` file under the *Package Service Providers* section:

```
  StelianAndrei\LaravelServerSideGA\AnalyticsServiceProvider::class,

```

Also add the Analytics facade to the *aliases* array in the same file:

```
  'Analytics' => StelianAndrei\LaravelServerSideGA\AnalyticsFacade::class,

```

Last thing you need to do is publish the configuration for this package. In order to do that all you need to do it run the following command:

```
php artisan vendor:publish --provider="StelianAndrei\LaravelServerSideGA\AnalyticsServiceProvider"

```

That will create a configuation file for this package at `config/analytics.php`where you need to enter the property code you are using for tracking events and page views. You can either keep it here or define the `ANALYTICS_TRACKING_ID`property in your *.env* file.

Tracking page views
-------------------

[](#tracking-page-views)

To track page views, use it as follows:

```
Analytics::trackPage($page, $title, $hitType)

```

Where:

- $page - (optional) the url of the page you are tracking (eg: `/about`)
- $title - (optional) the title of the page you are tracking (eg: `About us`)
- $hitType - (optional) the type of hit you are sending (defaults to `pageview`)

Tracking events
---------------

[](#tracking-events)

To track an event, use it as follows:

```
Analytics::trackEvent($category, $action, $label = null, $value = null)

```

Where:

- $category - the category of the event (eg: `Account creation`)
- $action - the action you're tracking (eg: `Click button`)
- $label - (optional) the label for the event (eg: `Recover password`)
- $value - (optional) an optional value for the event

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

2891d ago

Major Versions

0.1.2 → 1.0.02018-06-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/7dd10110f576e2ea34016be6269bbbd7400d264391c400f796f086428cb191ae?d=identicon)[StelianAndrei](/maintainers/StelianAndrei)

---

Top Contributors

[![StelianAndrei](https://avatars.githubusercontent.com/u/1508947?v=4)](https://github.com/StelianAndrei "StelianAndrei (19 commits)")

---

Tags

laravelanalyticsserver-side

### Embed Badge

![Health badge](/badges/stelianandrei-laravel-server-side-ga/health.svg)

```
[![Health](https://phpackages.com/badges/stelianandrei-laravel-server-side-ga/health.svg)](https://phpackages.com/packages/stelianandrei-laravel-server-side-ga)
```

###  Alternatives

[panphp/pan

A simple, lightweight, and privacy-focused product analytics php package.

1.2k94.6k5](/packages/panphp-pan)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[nickurt/laravel-akismet

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

97139.6k2](/packages/nickurt-laravel-akismet)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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