PHPackages                             code-tree-dev/laravel-utm-tracker - 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. code-tree-dev/laravel-utm-tracker

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

code-tree-dev/laravel-utm-tracker
=================================

A lightweight Laravel package that adds a middleware to automatically capture and store UTM parameters (like utm\_source, utm\_medium, utm\_campaign) from incoming requests. Makes it easy to track traffic sources across sessions for analytics, marketing attribution, or lead tracking.

2.0.2(9mo ago)395MITPHPPHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Oct 24Pushed 9mo agoCompare

[ Source](https://github.com/code-tree-dev/laravel-utm-tracker)[ Packagist](https://packagist.org/packages/code-tree-dev/laravel-utm-tracker)[ Docs](https://github.com/code-tree-dev/laravel-utm-tracker)[ RSS](/packages/code-tree-dev-laravel-utm-tracker/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

Laravel UTM Tracker
===================

[](#laravel-utm-tracker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/53dbec06a74432879575161c003f9f36a7f635a761be4ac0bd8ecb3e879aeb8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64652d747265652d6465762f6c61726176656c2d75746d2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/code-tree-dev/laravel-utm-tracker)[![Total Downloads](https://camo.githubusercontent.com/55d45111f97a0a170f2481191cc692e8601142f69fd1076b2c0a5c38e1391035/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64652d747265652d6465762f6c61726176656c2d75746d2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/code-tree-dev/laravel-utm-tracker)[![GitHub Actions](https://github.com/code-tree-dev/laravel-utm-tracker/actions/workflows/main.yml/badge.svg)](https://github.com/code-tree-dev/laravel-utm-tracker/actions/workflows/main.yml/badge.svg)

Laravel UTM Tracker is a package for Laravel that automatically or manually tracks UTM parameters from your visitors and stores them in your database. It is ideal for marketing attribution, analytics, and campaign tracking. The package is easy to configure, extend, and integrates seamlessly with Laravel middleware and facades.

Features
--------

[](#features)

- Automatic UTM tracking via middleware
- Manual UTM tracking via Facade
- Stores UTM data in the database, session, or cookie
- Easily extendable for custom UTM parameters
- Ready for analytics and marketing attribution

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

[](#installation)

Install the package via Composer:

```
composer require code-tree-dev/laravel-utm-tracker
```

Publish the config and migration files (optional):

```
php artisan vendor:publish --provider="CodeTreeDev\LaravelUtmTracker\LaravelUtmTrackerServiceProvider"
```

Run the migrations if using database storage:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

You can configure the package in `config/laravel-utm-tracker.php`:

- `storage`: Where to store UTM data (`session`, `cookie`, or `database`)
- `parameters`: Default UTM parameters to track
- `custom_parameters`: Add your own custom UTM parameters
- `cookie_lifetime`: Lifetime for cookies (if using cookie storage)
- `auto_track`: Enable/disable automatic tracking via middleware
- `table`: Table name for database storage

Usage
-----

[](#usage)

### Automatic Tracking (Middleware)

[](#automatic-tracking-middleware)

By default, the package's middleware is registered and will automatically capture UTM parameters from incoming requests:

```
// No action needed if auto_track is enabled in config.
```

### Manual Tracking (Facade)

[](#manual-tracking-facade)

You can manually create a UTM visit record using the Facade:

```
use LaravelUtmTracker;

LaravelUtmTracker::track([
    'utm_source' => 'newsletter',
    'utm_medium' => 'email',
    'utm_campaign' => 'spring_sale',
    // ...other fields...
]);
```

### Testing

[](#testing)

Run the test suite with:

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please read the [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) files for details.

- Open issues for bugs or feature requests
- Submit pull requests for improvements

Security
--------

[](#security)

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

Changelog
---------

[](#changelog)

See [CHANGELOG](CHANGELOG.md) for recent changes.

Credits
-------

[](#credits)

- [Code-Tree.dev](https://github.com/code-tree-dev)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). See [License File](LICENSE.md) for details.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance55

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Total

4

Last Release

296d ago

Major Versions

1.0.0 → 2.0.02025-10-24

PHP version history (2 changes)1.0.0PHP ^7.4|^8.0

2.0.0PHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117585305?v=4)[CodeTreeDev](/maintainers/codetreedev)[@codetreedev](https://github.com/codetreedev)

---

Top Contributors

[![Trukes](https://avatars.githubusercontent.com/u/6023213?v=4)](https://github.com/Trukes "Trukes (10 commits)")

---

Tags

laravellaravel-frameworklaravel-packagephputmutm-parameterscode-tree-devlaravel-utm-tracker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/code-tree-dev-laravel-utm-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/code-tree-dev-laravel-utm-tracker/health.svg)](https://phpackages.com/packages/code-tree-dev-laravel-utm-tracker)
```

###  Alternatives

[illuminate/pagination

The Illuminate Pagination package.

12234.6M1.1k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9350.2M310](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.8M410](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

224.7M145](/packages/illuminate-cookie)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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