PHP code example of mehdiyev-signal / pixel-manager
1. Go to this page and download the library: Download mehdiyev-signal/pixel-manager 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/ */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use MehdiyevSignal\PixelManager\Presentation\Facades\PixelManager;
class EventController extends Controller
{
public function track(Request $request)
{
PixelManager::track($request->all());
return response()->json(['success' => true]);
}
}
// Get all supported platforms
$platforms = PixelManager::platforms();
// Returns: ['meta', 'google', 'brevo', 'tiktok', 'pinterest', 'snapchat']
// Check if a platform is enabled
if (PixelManager::isPlatformEnabled('meta')) {
// Meta pixel is configured and enabled
}
use MehdiyevSignal\PixelManager\Infrastructure\Persistence\MongoDB\Models\CustomerEventModel;
$events = CustomerEventModel::where('event_name', 'purchase')
->where('created_at', '>=', now()->subDay())
->get();