- How do I install combindma/laravel-facebook-pixel in a Laravel app?
- Require the package with Composer using composer require combindma/laravel-facebook-pixel, then publish its config file with php artisan vendor:publish so the pixel settings live in your config directory. Add your Meta Pixel ID (and any other options) through environment variables so each environment can use a different pixel. Laravel's package auto-discovery registers the service provider and facade, so no manual wiring is needed. After that, drop the tracking snippet into your layout or use the package API to fire events.
- Which Laravel and PHP versions does this package support?
- The package targets modern Laravel applications on the 9.x, 10.x and 11.x lines running PHP 8.1 or newer with Composer 2. Because it is a thin integration layer, it does not require a specific queue driver, cache store or database table. Check the composer.json constraints on the repository before upgrading a major Laravel version, since framework support is declared there rather than in the README.
- How do I track a page view with this Laravel Facebook Pixel package?
- Include the pixel snippet the package provides in your main Blade layout so the base Meta Pixel code loads on every page, then let the standard PageView event fire on load. For single-page or partial-navigation flows you can trigger a page view explicitly from PHP or Blade whenever the route changes. Keep the snippet in one layout to avoid double-firing PageView, which inflates your Meta reporting.
- Can I fire custom and standard Meta Pixel events from PHP instead of JavaScript?
- Yes. The package exposes a developer-friendly facade so you can pass an event name and a parameters array directly from controllers, services or Blade templates, and it renders the corresponding fbq call in the response. Standard events such as Purchase, Lead or AddToCart use the same API as custom events, so you can keep naming consistent with Meta's event reference. The parameters you pass become the event payload, so include value and currency for commerce events.
- How do I configure the pixel ID and disable tracking in local or testing environments?
- Configuration is published to a dedicated config file and is typically driven by an environment variable holding the pixel ID. Set a null or empty value, or use the package's enable/disable switch, so no pixel script is rendered outside production. That keeps local requests clean and stops your development traffic from polluting Meta audiences and conversion data. Many teams also gate tracking behind an explicit config flag per environment.
- Does this package send server-side events to the Meta Conversions API?
- No. This package is a Meta Pixel integration: it renders the browser-side pixel and dispatches fbq events from PHP or Blade, so tracking happens in the user's browser. Server-side event delivery is Meta's Conversions API, which is a separate integration and is not what this wrapper provides. If you need deduplicated browser plus server events with event_id matching, plan for an additional Conversions API integration alongside this package.
- What happens if an ad blocker blocks the Meta Pixel, and how does that affect consent?
- When a blocker or browser privacy feature prevents the pixel from loading, fbq calls are silently dropped and those events never reach Meta, with no error thrown in your Laravel app. Because the package renders the standard snippet, you can conditionally include it based on your cookie consent state before outputting the Blade markup. There is no built-in consent management, so honouring GDPR or ePrivacy choices is your application's responsibility. Expect some under-reporting in analytics as a normal baseline.
- Why does composer update fail when resolving this package against facebook/php-business-sdk?
- Recent releases narrow the upstream SDK constraint to an explicit window covering only 25.0.0 and 25.0.1, so Composer refuses to resolve if your lockfile or another dependency needs 25.0.2 or later. If you hit that conflict, either let Composer resolve the SDK down to 25.0.0 or 25.0.1, or fork the package and widen the constraint yourself. Treat the pinned window as a signal that a specific upstream patch introduced a regression, and subscribe to the repository for the follow-up release. Also check whether the blocked patch contains security fixes you would be forgoing.
- How should I test a Laravel app that uses Facebook Pixel tracking?
- Disable the pixel in your testing environment so phpunit runs do not emit real tracking scripts or hit Meta endpoints. Then assert on rendered output, for example that the expected fbq event name and parameters appear in the response when tracking is enabled. Keeping the enable flag environment-driven makes both cases trivial to cover. Because tracking is client-side, there is nothing to mock at the HTTP layer for basic page view and event assertions.
- When should I use this package versus the Meta Business SDK or raw JavaScript?
- Use this package when you want a small, config-driven way to render the Meta Pixel and fire page views and events from Laravel PHP or Blade without hand-rolling snippets in every view. Reach for the official facebook/php-business-sdk when you need ad account management, campaigns, insights or custom audiences through the Marketing API, and write the raw pixel JavaScript yourself only if you want full control over the client-side code. Given the tight upstream dependency pinning in recent releases, follow the changelog and test dependency upgrades in CI before shipping them to production.