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(8y ago)11.3kMITPHPPHP ^7.0.0

Since Jun 12Pushed 8y 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 4w ago

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 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

2985d 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

[nativephp/mobile

NativePHP for Mobile

1.1k102.1k139](/packages/nativephp-mobile)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[oat-sa/tao-core

TAO core extension

65147.9k151](/packages/oat-sa-tao-core)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2087.0k31](/packages/ronasit-laravel-helpers)[ycodetech/valet-windows

A more enjoyable local development experience for Windows. A Windows port of the popular Laravel Valet and a fork of cretueusebiu/valet-windows, with new features.

451.8k](/packages/ycodetech-valet-windows)

PHPackages © 2026

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