Download the PHP package combindma/laravel-facebook-pixel without Composer

On this page you can find all versions of the php package combindma/laravel-facebook-pixel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-facebook-pixel

Meta Pixel integration for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Track events from the browser with Meta Pixel, from your server with the Conversions API, or both.

Requires PHP 8.3+ and Laravel 11, 12, or 13. Upgrading? See the v4 docs.

Quick start

1. Install

Create a Meta Pixel, then install the package:

2. Enable tracking

Add your Pixel ID to .env:

Tracking is disabled by default. Setting META_PIXEL_ENABLED=false disables both browser scripts and Conversions API requests.

3. Add the Blade components

Place these components in your shared layout. The head component automatically tracks PageView; the body component renders events added in your controller.

4. Track an event

In your controller, before returning the view:

Browser events

Use track() for standard Meta events and trackCustom() for your own events. Parameters and the third argument (event ID) are optional.

Repeated calls with the same event name preserve every event in insertion order.

Track after a redirect

Use flashEvent() to render a standard event on the next request. Custom events cannot be flashed.

First, add the middleware to the relevant routes in routes/web.php, after Laravel's session middleware. Apply it to both the route that redirects and the destination route:

Then, in your controller:

flashEvent() accepts the same parameters and optional event ID as track(), and preserves repeated events.

Conversions API

Complete the quick start, then generate an access token using Meta's setup guide. Add it to .env:

Find the optional app secret in Meta App Dashboard → Settings → Basic. Keep these credentials on the server.

Send browser and server events together

Use trackAndSend() to share one event ID across both channels so Meta can deduplicate the event. It generates an ID unless you provide one:

Use a unique ID for each event, and reuse it only for the browser/server copies of that event. The browser copy requires a response that renders the Blade components; for redirects, use flashEvent() and send() with the same ID instead.

Send a server-only event

Using the $customData above:

By default, server events include the request IP, user agent, and _fbc/_fbp cookies. With advanced matching enabled, they also include the authenticated user's email and ID when both are available.

To supply customer details, build on userData() and pass it as userData to either send() or trackAndSend():

For product details, add SDK Content objects with $customData->setContents([...]). See Meta's Payload Helper for event fields.

Test server events

Set META_TEST_EVENT_CODE in .env to the code from Meta Events Manager's Test Events tab. It is included in every API request. Remove it when testing is finished.

Configuration and helpers

Advanced matching is enabled by default: it adds the authenticated user's email and ID to browser and server events when both are available. Disable it with META_PIXEL_ADVANCED_MATCHING_ENABLED=false.

Environment variable Purpose / default
META_PIXEL_ID Your Pixel ID; empty by default
META_PIXEL_ENABLED Enable browser scripts and server requests; false
META_PIXEL_TOKEN Conversions API access token; empty by default
META_PIXEL_APP_SECRET Optional app secret for appsecret_proof
META_PIXEL_ADVANCED_MATCHING_ENABLED Include authenticated user details; true
META_PIXEL_SESSION_KEY Flashed-event session key; app name + _metaPixel
META_PIXEL_LOGGING API request/error logging; false
META_TEST_EVENT_CODE Server test-event code; unset by default

Publish the configuration or views only if you need to customize them:

Runtime helpers (using the MetaPixel facade):

Method Purpose
pixelId() / setPixelId($id) Read / change the Pixel ID
setToken($token) Change the API token
setTestEventCode($code) Set the server test-event code
isEnabled() / enable() / disable() Check / change tracking status
clear() Clear standard browser events for the current request

You can define reusable event methods with macros. Register them in a service provider's boot() method:

Development

Run tests with composer test. Contributions are welcome; include tests for behavior changes and bug fixes. Report vulnerabilities through the security policy.

Built by Combind and Contact us.

Licensed under the MIT License.


All versions of laravel-facebook-pixel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
facebook/php-business-sdk Version ~25.0.0,<25.0.2
illuminate/contracts Version ^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package combindma/laravel-facebook-pixel contains the following files

Loading the files please wait ...