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

On this page you can find all versions of the php package bkfdev/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

Facebook Pixel integration for Laravel

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

A Complete Facebook Pixel implementation for your Laravel application.

Introduction

This package provides a smooth integration of Meta Pixel, along with a straightforward implementation of the latest Conversions API, enhancing your overall experience.

Pre-requisites

Register a Meta Pixel

To get started with the pixel Meta, you must have a Meta 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:

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 install the FacebookPixelMiddleware, after the StartSession middleware:

Usage - Meta Pixel

Include scripts in Blade

Insert head view after opening head tag, and body view after opening body tag

Your events will also be rendered here. 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.

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

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-facebook-pixel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
facebook/php-business-sdk Version ^16.0
illuminate/contracts Version ^9.0|^10.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 bkfdev/laravel-facebook-pixel contains the following files

Loading the files please wait ....