composer require rezkonline/laravel-meta-pixel
The package will be automatically registered it's Service Provider and Facade
// config/app.php
'providers' => [
//
\Rezkonline\LaravelMetaPixel\Providers\MetaPixelServiceProvider::class,
//
],
'facades' => [
//
'LaravelMetaPixel' => \Rezkonline\LaravelMetaPixel\Facades\MetaPixelFacade::class,
//
],
Next, publish the config file:
php artisan vendor:publish --provider="Rezkonline\LaravelMetaPixel\Providers\MetaPixelServiceProvider"
return [
/*
* The Facebook Meta ID.
*/
'meta_pixel_id' => env('META_PIXEL_ID', ''),
];
{{-- layout.blade.php --}}
<html>
<head>
@include('meta-pixel::script')
{{-- !!! --}}
</head>
<body>
{{-- !!! --}}
</body>
</html>
Call a function based on Meta Pixel standarted events Standard Event according to the following table:
Event | Method |
---|---|
AddPaymentInfo | addPaymentInfoEvent |
AddToCart | addToCartEvent |
AddToWishlist | addToWishlistEvent |
CompleteRegistration | completeRegistrationEvent |
Contact | contactEvent |
CustomizeProduct | customizeProductEvent |
Donate | donateEvent |
FindLocation | findLocationEvent |
Lead | leadEvent |
InitiateCheckout | initiateCheckoutEvent |
Purchase | purchaseEvent |
Schedule | scheduleEvent |
Search | searchEvent |
StartTrial | startTrialEvent |
SubmitApplication | submitApplicationEvent |
Subscribe | subscribeEvent |
ViewContent | viewContentEvent |
\LaravelMetaPixel::addToCartEvent([
// List of event parameters
])
The MIT License (MIT). Please head to License File for more information.