Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Pixel

Laravel Pixel Laravel Package

jeffersongoncalves/laravel-pixel

A lightweight Laravel package for adding tracking pixels such as Meta and Google to your app, with config-driven pixel IDs, Blade directives, and helpers for firing page views and conversion events cleanly.

View on GitHub
Deep Wiki
Context7

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.

Frequently asked questions about Laravel Pixel
How do I install jeffersongoncalves/laravel-pixel in a Laravel application?
Install the package with Composer using composer require jeffersongoncalves/laravel-pixel. Follow the repository README for any required publishing steps, settings migrations, or configuration, especially if you plan to use dynamic Pixel IDs through spatie/laravel-settings. The package is designed to fit standard Laravel rendering and Vite asset pipelines.
How do I configure the Meta Pixel ID dynamically from the database?
The package uses spatie/laravel-settings so you can store the Meta Pixel ID in the database and update it from an admin panel instead of editing .env files. You define and resolve the Pixel ID through the package's settings integration at render time. This lets you change Pixel IDs without redeploying environment configuration.
Does laravel-pixel support Google Pixel or only Meta Pixel?
The package overview focuses on Meta (Facebook) Pixel and dynamic Meta Pixel ID management via spatie/laravel-settings. The short blurb also mentions tracking pixels such as Meta and Google, so check the README for exact Google support and configuration details. For Meta Pixel, database-driven IDs, Blade directives, and helpers are the core documented features.
Which Laravel versions are supported by laravel-pixel?
The technical assessment positions the package for Laravel 10/11-era applications that use Vite and standard Blade rendering. Always check the repository composer.json for the exact illuminate/support constraint before installing. If you are on an older or newer Laravel version, verify compatibility in a staging branch first.
How do I fire Meta Pixel page views and conversion events with this package?
Use the package's Blade directives to add the Meta Pixel base snippet to your layout, then use the provided helpers to fire page views and conversion events. Typical usage is to call a helper after a controller action or inside a Blade view with the relevant event payload. See the README for exact directive names, helper methods, and event data formats.
Does laravel-pixel work with a strict Content Security Policy nonce?
Release 3.1.0 adds CSP nonce propagation to every emitted script, which supports nonce-based script-src policies without requiring unsafe-inline. If your Laravel app exposes a Vite CSP nonce, the package should pick it up automatically when scripts are rendered. Confirm the nonce is available at render time and test with Content-Security-Policy-Report-Only before enforcing the policy.
How should I test Meta Pixel events and CSP behavior before production?
In staging, enable Content-Security-Policy-Report-Only and inspect browser console errors and CSP reports for blocked scripts. Use Meta Events Manager test events or browser pixel debugging tools to confirm page views and conversions fire correctly. Also test with no nonce configured to verify that fallback behavior is unchanged.
Can I use laravel-pixel with Livewire, Inertia, or Blade components?
The package targets standard Laravel rendering and Vite pipelines, while the assessment notes that Livewire, Inertia, and Blade component contexts should be verified for your app. In Livewire or Inertia applications, ensure the pixel script and event helpers run on initial page render and on client-side navigation where needed. Run a staging test with your CSP and nonce setup before relying on it in production.
What are the alternatives to laravel-pixel for Meta Pixel tracking in Laravel?
Alternatives include manually adding the Meta Pixel snippet to your Blade layout, using a broader analytics package, or integrating Meta's Conversions API through a server-side package. laravel-pixel's differentiator is dynamic Pixel ID management via spatie/laravel-settings plus Blade directives, helpers, and CSP nonce support. Choose based on whether you need database-driven IDs and nonce-aware script rendering or a wider analytics abstraction.
How is laravel-pixel maintained, and what should I check before upgrading?
Treat 3.1.0 as an additive upgrade from 3.0.x; applications without CSP should see no behavioral change. Pin versions, monitor upstream releases for CSP-related changes, and document how your app sources the Vite nonce for debugging. For strict CSP deployments, roll out with report-only first and define rollback criteria before removing unsafe-inline.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource