PHP code example of combindma / laravel-facebook-pixel
1. Go to this page and download the library: Download combindma/laravel-facebook-pixel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
combindma / laravel-facebook-pixel example snippets
use Combindma\FacebookPixel\MetaPixelMiddleware;
use Illuminate\Support\Facades\Route;
Route::middleware(MetaPixelMiddleware::class)->group(function () {
// Your form and thank-you routes...
});
use Combindma\FacebookPixel\Facades\MetaPixel;
MetaPixel::flashEvent('Lead', ['content_name' => 'Contact form']);
return redirect('/thank-you');
use Combindma\FacebookPixel\Facades\MetaPixel;
use FacebookAds\Object\ServerSide\CustomData;
$customData = (new CustomData())
->setCurrency('USD')
->setValue(30.00);
MetaPixel::trackAndSend(
'Purchase',
['currency' => 'USD', 'value' => 30.00],
$customData,
eventId: 'order-123',
);