- 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.