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.
Download combindma/laravel-facebook-pixel
More information about combindma/laravel-facebook-pixel
Files in combindma/laravel-facebook-pixel
Package laravel-facebook-pixel
Short Description Meta pixel integration for Laravel
License MIT
Homepage https://github.com/combindma/laravel-facebook-pixel
Informations about the package laravel-facebook-pixel
Meta Pixel integration for Laravel
A Complete Meta pixel implementation for your Laravel application.
About Combind Agency
Combine Agency is a leading web development agency specializing in building innovative and high-performance web applications using modern technologies. Our experienced team of developers, designers, and project managers is dedicated to providing top-notch services tailored to the unique needs of our clients.
If you need assistance with your next project or would like to discuss a custom solution, please feel free to website for more information about our services. Let's build something amazing together!
Introduction
This package provides a smooth integration of Meta Pixel, along with a straightforward implementation of the latest Conversions API, enhancing your overall experience.
- Documentation for version 4.0 - older version
Upgrading to Version 5
If you are upgrading from version 4, please refer to our Version 5 Migration Guide for detailed instructions on how to make a smooth transition.
Pre-requisites
Register a Meta Pixel
To get started with the Meta pixel, you must have a pixel registered: Read this guide.
Conversions API
If you plan to use Conversions API then you need to:
Obtain An Access Token
To use the Conversions API, you need to generate an access token, which will be passed as a parameter in every API call.
Refer to Conversions API Guide to learn more.
Installation
You can install the package via composer:
Optionally, you can publish the views using:
You can publish the config file with:
This is the contents of the published config file:
If you plan on using the flash-functionality you must register the MetaPixelMiddleware:
Global Middleware:
Or Assigning Middleware to Routes (recommended if you have admin routes):
Usage - Meta Pixel
Include scripts in Blade
Insert head view after opening head tag, and body view after opening body tag
If you use UUID as user id you should add userIdAsString attribute to the head component:
To add an event, use the track()
function.
This renders:
You can also specify a unique event ID for any of your events so that, if you plan using the conversions API you avoid duplications.
Flashing data for the next request
The package can also set event to render on the next request. This is useful for setting data after an internal redirect.
After a form submit, the following event will be parsed on the contact page:
Available Methods
Custom Events
You can also track a specific custom event on your website. This feature is not available for flashed events.
This renders:
Advanced matching
This package provides by default advanced matching. We retrieve the email and the user id from authenticated user and include it in the Pixel base code fbq('init') function call as a third parameter. You can disable it by adding META_PIXEL_ADVANCED_MATCHING_ENABLED=false in your .env file
Macroable
Adding events to pages can become a repetitive process. Since this package isn't supposed to be opinionated on what your events should look like, the MetaPixel is macroable.
Usage - Conversions API
If you plan on using Conversions API functionalities. Yous should specify the token in your .env file first.
For every request yous should specify a unique event id for handling Pixel Duplicate Events and Conversions API.
This is how you can start:
If you don't specify the $user_data parameter, by default we retrieve the email & the id from Auth::user() if the user is authenticated. We use the user id as a same external_id in Meta Pixel and conversions API
If you want to test server events, you need to specify the FACEBOOK_TEST_EVENT_CODE in your .env file. By default, this test code will be sent in all API request.
So Don't forget to delete after you finish your server tests.
You can use the Playload Helper to learn more about the requests to send.
Testing
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Combind
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-facebook-pixel with dependencies
facebook/php-business-sdk Version ^19.0
illuminate/contracts Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.11