PHPackages                             irazasyed/laravel-gamp - 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. irazasyed/laravel-gamp

ActiveLibrary[API Development](/categories/api)

irazasyed/laravel-gamp
======================

Send analytics data to Google Analytics from Laravel. A package for GA Measurement Protocol API

v1.10(3y ago)3361.6M↓15.5%34[4 issues](https://github.com/irazasyed/laravel-gamp/issues)1MITPHPPHP ^7.2 || ^8.0CI failing

Since Feb 27Pushed 2y ago17 watchersCompare

[ Source](https://github.com/irazasyed/laravel-gamp)[ Packagist](https://packagist.org/packages/irazasyed/laravel-gamp)[ RSS](/packages/irazasyed-laravel-gamp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (18)Used By (1)

Laravel-GAMP Package
====================

[](#laravel-gamp-package)

[![Join PHP Chat](https://camo.githubusercontent.com/29f67fb2289efd1ecede6eaa41c82be0e3f93dbf5a8193f1f0fc1b4f33719fa7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536c61636b2d504850253230436861742d3563366161612e7376673f7374796c653d666c61742d737175617265266c6f676f3d736c61636b266c6162656c436f6c6f723d344131353442)](https://phpchat.co/?ref=laravel-gamp)[![Chat on Telegram](https://camo.githubusercontent.com/c793b6d887d39dac6773fa734b19b63fb1b8a392156528c648c2564000509eba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4050485043686174436f2d3243413545302e7376673f7374796c653d666c61742d737175617265266c6f676f3d74656c656772616d266c6162656c3d54656c656772616d)](https://t.me/PHPChatCo)[![Laravel & Lumen Package](https://camo.githubusercontent.com/05ed7edaba13a75eaafd5857ae35d434710237d93db1068dac0600cf446366c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d357e31302d4646324432302e7376673f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6162656c436f6c6f723d626c61636b266c6f676f436f6c6f723d7768697465)](https://github.com/irazasyed/laravel-gamp)[![Latest Version on Packagist](https://camo.githubusercontent.com/591ce72b850b6d8864f76fd008a5310df712bf97dcd0fc3c724810c1dbf15ed7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6972617a61737965642f6c61726176656c2d67616d702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/irazasyed/laravel-gamp)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/b7a6b0e9871c04037412785744e3c26c25b75669755426655eecb2217e29b8e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6972617a61737965642f6c61726176656c2d67616d702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/irazasyed/laravel-gamp/stats)

> Laravel GAMP: Google Analytics Measurement Protocol Package for Laravel &amp; Lumen.
>
> Send data to Google Analytics from Laravel/Lumen. Supports all GA Measurement Protocol API methods.

[![Laravel GAMP](https://cloud.githubusercontent.com/assets/1915268/8476296/b49f74ac-20dd-11e5-8698-aa23b2f7e6fd.png)](https://github.com/irazasyed)

Quick start
-----------

[](#quick-start)

### Install

[](#install)

#### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
$ composer require irazasyed/laravel-gamp
```

#### (Lumen) Add the Service Provider

[](#lumen-add-the-service-provider)

Open `bootstrap/app.php` and register the service provider by adding:

```
$app->register(Irazasyed\LaravelGAMP\LaravelGAMPServiceProvider::class);
```

#### Step 2: Publish Config

[](#step-2-publish-config)

Open your terminal window and fire the following command to publish config file to your config directory:

```
$ php artisan vendor:publish --provider="Irazasyed\LaravelGAMP\LaravelGAMPServiceProvider"
```

Usage
-----

[](#usage)

Open config file `config/gamp.php` and set the `tracking_id` with your Google Analytics tracking / web property ID. Refer the config file for other default configuration settings.

This Package adds Laravel Support to [GA Measurement Protocol](https://github.com/theiconic/php-ga-measurement-protocol) PHP Library by THE ICONIC. It's simply a wrapper around the library with default config for easier usage with Laravel. So all the methods listed [here](https://github.com/theiconic/php-ga-measurement-protocol#usage) are available and will work seamlessly.

### Example Usage

[](#example-usage)

Send a Page view hit:

```
use Irazasyed\LaravelGAMP\Facades\GAMP;

$gamp = GAMP::setClientId( '123456' );
$gamp->setDocumentPath( '/page' );
$gamp->sendPageview();
```

Send an Event:

```
use Irazasyed\LaravelGAMP\Facades\GAMP;

$gamp = GAMP::setClientId( '123456' );
$gamp->setEventCategory('Blog Post')
->setEventAction('Create')
->setEventLabel('Using GAMP In Laravel')
->sendEvent();
```

### Config Overview

[](#config-overview)

Open the config file for detailed comments for each option.

Set your Google Analytics Tracking / Web Property ID in `tracking_id` key **\[REQUIRED\]**

```
'tracking_id' => 'UA-XXXX-Y',
```

All other configuration options are optional, use as per your requirements.

To send data over SSL, set `is_ssl` to true.

```
'is_ssl' => true,
```

To disable library in Staging/Dev env (Prevents the library from sending any hits to GA), set `is_disabled` to true.

```
'is_disabled' => true,
```

To Anonymize IP, set `anonymize_ip` to true.

```
'anonymize_ip' => true,
```

To Make Async Requests, set `async_requests` to true.

```
'async_requests'  => true,
```

...

Refer the library's [documentation](https://github.com/theiconic/php-ga-measurement-protocol#usage) for other remaining methods and examples, they all work.

> **Note:** You don't have to use the protocol version, tracking id, anonymize ip and async request (non-blocking) methods from the original library as they're automatically set in Service Provider when the package is initialized based on the config file. As long as you update the config file with correct settings, it should work just fine.

Additional information
----------------------

[](#additional-information)

Any issues, please [report here](../../issues)

Credits
-------

[](#credits)

- [Syed Irfaq R.](https://github.com/irazasyed) - For Laravel and Lumen Bridge.
- [THE ICONIC](https://github.com/theiconic/php-ga-measurement-protocol) - For GA Measurement Protocol PHP Library.
- [All Contributors](../../contributors)

License
-------

[](#license)

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

[![FOSSA Status](https://camo.githubusercontent.com/129d2def97db454667463eb93648c342ebdff837f1871d8c31cf94c3d0287686/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532466972617a61737965642532466c61726176656c2d67616d702e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2Firazasyed%2Flaravel-gamp?ref=badge_large)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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 ~182 days

Recently: every ~255 days

Total

17

Last Release

1188d ago

Major Versions

v0.5.0 → v1.0.02015-07-03

0.5.x-dev → v1.2.02017-04-10

PHP version history (5 changes)v0.1.0PHP &gt;=5.4.0

v1.0.0PHP &gt;=5.5.0

v1.2.0PHP &gt;=5.6.4

v1.4PHP ^7.2

v1.8PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1915268?v=4)[Irfaq Syed](/maintainers/irazasyed)[@irazasyed](https://github.com/irazasyed)

---

Top Contributors

[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (77 commits)")[![jdanino](https://avatars.githubusercontent.com/u/10063518?v=4)](https://github.com/jdanino "jdanino (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (1 commits)")[![shuvroroy](https://avatars.githubusercontent.com/u/21066418?v=4)](https://github.com/shuvroroy "shuvroroy (1 commits)")[![james2doyle](https://avatars.githubusercontent.com/u/1425304?v=4)](https://github.com/james2doyle "james2doyle (1 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

---

Tags

analyticsga-measurement-protocolgampgoogle-analyticshacktoberfestlaravellaravel-5-packagelaravel-6-packagelaravel-7-packagelaravel-8-packagelaravel-gamplaravel-google-analyticslaravel-packagelaravel-packagestrackinganalyticsgoogle-analyticsmeasurement protocollaravel google analyticsga measurement protocollumen google analytics

### Embed Badge

![Health badge](/badges/irazasyed-laravel-gamp/health.svg)

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

###  Alternatives

[alexwestergaard/php-ga4

PHP Library for Google Analytics 4 with Server Side Tagging

63144.7k1](/packages/alexwestergaard-php-ga4)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

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

Create and run Google Analytics Data API queries in Laravel

3868.4k](/packages/gtmassey-laravel-analytics)[thujohn/analytics

Google Analytics for Laravel 4

113108.7k1](/packages/thujohn-analytics)[baibaratsky/yii2-ga-measurement-protocol

Google Analytics Measurement Protocol for Yii2

13104.2k](/packages/baibaratsky-yii2-ga-measurement-protocol)[there4/php-analytics-event

Send Google Analytics events from PHP

2441.1k](/packages/there4-php-analytics-event)

PHPackages © 2026

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