PHPackages                             jeffersongoncalves/laravel-pixel - 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. jeffersongoncalves/laravel-pixel

ActiveLibrary

jeffersongoncalves/laravel-pixel
================================

This Laravel package offers a straightforward way to integrate Meta (Facebook) Pixel into your application. By configuring your Pixel ID, you can effortlessly track user interactions, page views, conversions, and other valuable events on your website. This helps you gather insights into your audience behavior and optimize your advertising campaigns. The package simplifies the process of adding the Pixel script to your Blade templates, enabling seamless analytics collection with minimal setup.

2.0.1(2mo ago)256↓50%1MITPHPPHP ^8.2|^8.3CI passing

Since May 2Pushed 1mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (7)Versions (5)Used By (1)

[![Laravel Pixel](https://raw.githubusercontent.com/jeffersongoncalves/laravel-pixel/master/art/jeffersongoncalves-laravel-pixel.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-pixel/master/art/jeffersongoncalves-laravel-pixel.png)

Laravel Pixel
=============

[](#laravel-pixel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3211ea02e686692798c0bd10cf60d27e035c2ecc4188c74874b825a52325a96f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d706978656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-pixel)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/638445ad36b38edd9546f2266c9712822ae3c24c85fe64c783591e45967a0133/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d706978656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-pixel/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/573b2924bbc28987dd78a8c291c360f8580972409d1c3fdd7c9ead062f178beb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d706978656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-pixel)

This Laravel package offers a straightforward way to integrate Meta (Facebook) Pixel into your application. The Pixel ID is stored in the database using [spatie/laravel-settings](https://github.com/spatie/laravel-settings), allowing you to manage it dynamically (e.g., via an admin panel) without relying on `.env` files or static config.

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

[](#installation)

Install the package via composer:

```
composer require jeffersongoncalves/laravel-pixel
```

Publish and run the spatie/laravel-settings migrations (if not already done):

```
php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
php artisan migrate
```

Publish and run the pixel settings migration:

```
php artisan vendor:publish --tag="pixel-settings-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Setting the Pixel ID

[](#setting-the-pixel-id)

You can set the Pixel ID programmatically using any of these methods:

**Helper function:**

```
$settings = pixel_settings();
$settings->pixel_id = '123456789';
$settings->save();
```

**Facade:**

```
use JeffersonGoncalves\Pixel\Facades\PixelSettings;

$settings = PixelSettings::getFacadeRoot();
$settings->pixel_id = '123456789';
$settings->save();
```

**Container resolution:**

```
use JeffersonGoncalves\Pixel\Settings\PixelSettings;

$settings = app(PixelSettings::class);
$settings->pixel_id = '123456789';
$settings->save();
```

### Adding the Pixel script to your layout

[](#adding-the-pixel-script-to-your-layout)

Include the Blade component in your layout's `` tag:

```
@include('pixel::script')
```

The script will only render when a valid Pixel ID is configured. If the Pixel ID is `null` or empty, nothing will be rendered.

### Reading the Pixel ID

[](#reading-the-pixel-id)

```
$pixelId = pixel_settings()->pixel_id; // returns string|null
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jèfferson Gonçalves](https://github.com/jeffersongoncalves)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance87

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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 ~149 days

Total

3

Last Release

77d ago

Major Versions

1.0.0 → 2.0.02026-02-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411493?v=4)[Jefferson Gonçalves](/maintainers/jeffersongoncalves)[@jeffersongoncalves](https://github.com/jeffersongoncalves)

---

Top Contributors

[![jeffersongoncalves](https://avatars.githubusercontent.com/u/411493?v=4)](https://github.com/jeffersongoncalves "jeffersongoncalves (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")

---

Tags

composerfacebook-pixelfacebook-trackingjeffersongoncalveslaravellaravel-packagelaravel-pixelmeta-pixelphpspatie-laravel-settingslaraveljeffersongoncalveslaravel-pixel

###  Code Quality

TestsPest

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/jeffersongoncalves-laravel-pixel/health.svg)

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

###  Alternatives

[jeffersongoncalves/filament-topbar

A simple yet effective Filament plugin that automatically adds a customized topbar to your Filament admin panel. This plugin enhances your Filament panel's user experience by replacing the default topbar component with an improved version that displays navigation and user interface elements in strategic locations.

171.2k](/packages/jeffersongoncalves-filament-topbar)

PHPackages © 2026

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