PHP code example of medboubazine / facebook-pixel

1. Go to this page and download the library: Download medboubazine/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/ */

    

medboubazine / facebook-pixel example snippets



use Medboubazine\FacebookPixel\Elements\EventCredentialsElement;
use Medboubazine\FacebookPixel\Elements\Events\ProductElement;
use Medboubazine\FacebookPixel\Elements\Events\UserElement;
use Medboubazine\FacebookPixel\FacebookPixel;

 $pixel->page_view_event()->handle($user, "URL_HERE");

$response = $event->push();
///
/// Purchase Event
///
$user = new UserElement("IP", "UserAgent");
$product = new ProductElement("21", 1, "20.34", "usd", "URL_HERE");

$event = $pixel->purchase_event()->handle($user, $product);


$response = $event->push();