PHPackages                             mehdiyev-signal/pixel-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mehdiyev-signal/pixel-manager

ActiveLibrary[API Development](/categories/api)

mehdiyev-signal/pixel-manager
=============================

Multi-platform pixel event tracking and distribution for Laravel with DDD architecture

v2.0.0(4mo ago)10MITPHPPHP ^8.2CI failing

Since Feb 4Pushed 4mo agoCompare

[ Source](https://github.com/salehmehdi/pixel-manager)[ Packagist](https://packagist.org/packages/mehdiyev-signal/pixel-manager)[ RSS](/packages/mehdiyev-signal-pixel-manager/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (10)Versions (2)Used By (0)

Pixel Manager v2.0
==================

[](#pixel-manager-v20)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d19ad9968f09d51f707d603b070f8587caa7f291654dac9b62aae771e7ccb38c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d656864697965762d7369676e616c2f706978656c2d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mehdiyev-signal/pixel-manager)[![Total Downloads](https://camo.githubusercontent.com/1c018d9ea398615de7900f4f3c14c74dc0e59c91c324b3cf1b9582e9cc25fa74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d656864697965762d7369676e616c2f706978656c2d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mehdiyev-signal/pixel-manager)[![Tests](https://github.com/salehmehdi/pixel-manager/workflows/Tests/badge.svg)](https://github.com/salehmehdi/pixel-manager/actions)[![License](https://camo.githubusercontent.com/92347f191b9a7ac8a4b195775a62ef1719f79427b03f78347c49155e31d681c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d656864697965762d7369676e616c2f706978656c2d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A powerful, production-ready Laravel package for tracking and distributing customer events to multiple marketing platforms with enterprise-grade reliability and security.

**🆕 Version 2.0 - Complete rewrite with Domain-Driven Design, all bugs fixed, production-ready!**

✨ Features
----------

[](#-features)

### Core Features

[](#core-features)

- 🚀 **Multi-Platform Support**: Meta, Google, Brevo, TikTok, Pinterest, Snapchat
- ⚡ **Asynchronous Processing**: Queue-based event distribution
- 🎯 **Event Mapping**: Configure which platforms receive specific events
- 📊 **MongoDB Logging**: Track all events for analytics
- 🔧 **Highly Configurable**: Flexible configuration system

### v2.0 New Features

[](#v20-new-features)

- 🏗️ **Domain-Driven Design**: Clean, maintainable architecture
- 🔒 **AES-256 Encryption**: Secure credential storage
- ♻️ **Auto-Retry**: Exponential backoff (3 attempts)
- 🛡️ **Circuit Breaker**: Prevents cascading failures
- 🚦 **Rate Limiting**: Protects against API limits
- 💾 **Smart Caching**: 90% reduction in DB queries
- 🤖 **Bot Detection**: Filters out crawler traffic
- 🔐 **SHA256 Hashing**: Privacy-compliant PII handling
- 🌍 **33 Currencies**: Including AZN (Azerbaijani Manat) 🇦🇿
- 🐛 **All Bugs Fixed**: Meta, Google, Pinterest issues resolved
- 🗄️ **SQL Support**: MySQL, PostgreSQL, SQLite (in addition to MongoDB)
- 🔧 **Extensible**: Easy to add new platforms and events

Requirements
------------

[](#requirements)

### Core Requirements

[](#core-requirements)

- PHP 8.2 or higher
- Laravel 11.0 or higher
- Queue driver (Redis, Database, etc.)

### Optional Dependencies (Based on Your Setup)

[](#optional-dependencies-based-on-your-setup)

**Choose ONE credential storage method:**

- **ENV Mode** (Simplest): No extra dependencies needed ✅
- **SQL Mode**: Uses Laravel's built-in database (MySQL/PostgreSQL/SQLite) ✅
- **MongoDB Mode**: Requires `composer require mongodb/laravel-mongodb`

**Platform-Specific (Install only what you use):**

- **Meta/Facebook Pixel**: Requires `composer require facebook/php-business-sdk`
- **Other platforms** (Google, TikTok, etc.): Work out of the box with Guzzle HTTP client ✅

**Note:** Start with ENV mode for quick setup, upgrade to database mode when needed!

Installation
------------

[](#installation)

### ⚡ Quick Start (5 minutes - ENV Mode)

[](#-quick-start-5-minutes---env-mode)

For simple setups without database configuration:

```
# Install core package
composer require mehdiyev-signal/pixel-manager

# Optional: Install Meta SDK if using Facebook/Meta Pixel
composer require facebook/php-business-sdk
```

Add credentials to `.env`:

```
PIXEL_MANAGER_DRIVER=env
PIXEL_META_PIXEL_ID=your_pixel_id
PIXEL_META_ACCESS_TOKEN=your_token
```

**Done!** See **[QUICK-START.md](QUICK-START.md)** for details.

### 🗄️ MongoDB Mode Installation

[](#️-mongodb-mode-installation)

```
# Install core package
composer require mehdiyev-signal/pixel-manager

# Install MongoDB driver
composer require mongodb/laravel-mongodb

# Optional: Meta SDK
composer require facebook/php-business-sdk
```

### 💾 SQL Mode Installation

[](#-sql-mode-installation)

```
# Install core package (SQL support built-in with Laravel)
composer require mehdiyev-signal/pixel-manager

# Optional: Meta SDK
composer require facebook/php-business-sdk
```

### 📚 Full Installation

[](#-full-installation)

For multi-environment or advanced setups:

```
composer require mehdiyev-signal/pixel-manager
```

**Upgrading from v1.x?** See [UPGRADE-2.0.md](UPGRADE-2.0.md) for migration guide.

Publish the configuration file:

```
php artisan vendor:publish --tag=pixel-manager-config
```

Optionally, publish the migration files:

```
php artisan vendor:publish --tag=pixel-manager-migrations
php artisan migrate
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

Add the following to your `.env` file:

```
# Basic Configuration
PIXEL_MANAGER_APP_ID=40
PIXEL_MANAGER_DB_CONNECTION=mongodb
PIXEL_MANAGER_COLLECTION=mp_customer_event
PIXEL_MANAGER_QUEUE=default
PIXEL_MANAGER_LOGGING=true

# v2.0 Performance Features
PIXEL_MANAGER_CACHE_ENABLED=true
PIXEL_MANAGER_CACHE_TTL=3600
PIXEL_MANAGER_RETRY_ENABLED=true
PIXEL_MANAGER_RETRY_MAX_ATTEMPTS=3

# v2.0 Resilience Features
PIXEL_MANAGER_CIRCUIT_BREAKER_ENABLED=true
PIXEL_MANAGER_CIRCUIT_BREAKER_THRESHOLD=5
PIXEL_MANAGER_RATE_LIMITING_ENABLED=true
PIXEL_MANAGER_RATE_LIMIT=100

# v2.0 Security Features
PIXEL_MANAGER_ENCRYPT_CREDENTIALS=true
PIXEL_MANAGER_BOT_DETECTION=true

# MongoDB Connection
DB_CONNECTION=mongodb
DB_DSN=mongodb://localhost:27017
DB_DATABASE=your_database
```

### Platform Credentials

[](#platform-credentials)

Store your platform credentials in MongoDB's `applications` collection:

```
db.applications.insertOne({
    app_id: 40,
    category: "customer_event",
    data: {
        // Meta Pixel
        meta_pixel_id: "YOUR_META_PIXEL_ID",
        meta_access_token: "YOUR_META_ACCESS_TOKEN",

        // Google Analytics 4
        google_measurement_id: "YOUR_GA4_MEASUREMENT_ID",
        google_api_secret: "YOUR_GA4_API_SECRET",

        // Brevo
        brevo_api_key: "YOUR_BREVO_API_KEY",

        // TikTok
        tiktok_pixel_code: "YOUR_TIKTOK_PIXEL_CODE",
        tiktok_access_token: "YOUR_TIKTOK_ACCESS_TOKEN",

        // Pinterest
        pinterest_account_id: "YOUR_PINTEREST_ACCOUNT_ID",
        pinterest_access_token: "YOUR_PINTEREST_ACCESS_TOKEN",

        // Snapchat
        snapchat_pixel_id: "YOUR_SNAPCHAT_PIXEL_ID",
        snapchat_access_token: "YOUR_SNAPCHAT_ACCESS_TOKEN"
    }
})
```

### Event Mapping

[](#event-mapping)

Configure which platforms receive specific events in `config/pixel-manager.php`:

```
'event_mappings' => [
    'purchase' => ['meta', 'google', 'tiktok', 'brevo', 'pinterest', 'snapchat'],
    'add_to_cart' => ['meta', 'google', 'tiktok', 'brevo', 'pinterest', 'snapchat'],
    'view_item' => ['meta', 'google', 'tiktok', 'brevo'],
    'search' => ['meta', 'google'],
    // Add more event mappings...
],
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Use the Facade to track events:

```
use MehdiyevSignal\PixelManager\Presentation\Facades\PixelManager;

PixelManager::track([
    'data' => [
        'event_type' => 'purchase',
        'event' => 'purchase',
        'transaction_id' => 'TXN123456',
        'order_id' => 'ORD789',
        'value' => 99.99,
        'currency' => 'USD',
        'shipping' => 5.00,
        'customer' => [
            'email' => 'customer@example.com',
            'external_id' => 'user_12345',
            'first_name' => 'John',
            'last_name' => 'Doe',
            'phone' => '+1234567890',
            'city' => 'New York',
            'state' => 'NY',
            'country_code' => 'US',
            'zip_code' => '10001',
        ],
        'items' => [
            [
                'item_id' => 'PROD123',
                'item_name' => 'Premium Widget',
                'price' => 49.99,
                'quantity' => 2,
                'category' => 'Electronics',
                'item_brand' => 'BrandName',
            ]
        ]
    ]
]);
```

### In a Controller

[](#in-a-controller)

```
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]);
    }
}
```

### Check Platform Status

[](#check-platform-status)

```
// 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
}
```

Supported Events
----------------

[](#supported-events)

The package supports the following standard events:

Event TypeDescriptionPlatforms`purchase`Completed purchaseAll`add_to_cart`Product added to cartAll`view_item`Product viewedAll`begin_checkout`Checkout startedAll`view_cart`Shopping cart viewedAll`search`Search performedAll`add_payment_info`Payment info addedAll`add_to_wishlist`Item added to wishlistAll`page_view`Page viewedAll`completed_registration`User registrationAll`subscription`Subscription createdAll`customize_product`Product customizationMeta onlyPlatform-Specific Features
--------------------------

[](#platform-specific-features)

### Meta Pixel

[](#meta-pixel)

- Server-side event tracking
- Automatic user data hashing
- FBC/FBP tracking support
- Full Facebook Business SDK integration

### Google Analytics 4

[](#google-analytics-4)

- Measurement Protocol v2
- Standard GA4 event names
- Rich e-commerce data
- Client ID and User ID support

### Brevo

[](#brevo)

- Contact identification (email, WhatsApp, external ID)
- Contact properties tracking
- Event properties with cart data
- Real-time CRM updates

### TikTok, Pinterest, Snapchat

[](#tiktok-pinterest-snapchat)

- Server-side conversion tracking
- Product catalog integration
- Advanced event parameters
- Audience building support

Queue Configuration
-------------------

[](#queue-configuration)

The package uses Laravel's queue system for asynchronous processing. Make sure to configure your queue driver:

```
QUEUE_CONNECTION=redis
PIXEL_MANAGER_QUEUE=pixel-events
```

Run the queue worker:

```
php artisan queue:work --queue=pixel-events
```

Event Logging
-------------

[](#event-logging)

All events are logged to MongoDB for analytics and debugging. Access logs through the `CustomerEventModel`:

```
use MehdiyevSignal\PixelManager\Infrastructure\Persistence\MongoDB\Models\CustomerEventModel;

$events = CustomerEventModel::where('event_name', 'purchase')
    ->where('created_at', '>=', now()->subDay())
    ->get();
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

With coverage:

```
composer test-coverage
```

Troubleshooting
---------------

[](#troubleshooting)

### Events Not Being Sent

[](#events-not-being-sent)

1. Check queue worker is running
2. Verify platform credentials in MongoDB
3. Check `storage/logs/laravel.log` for errors
4. Ensure event type is mapped in config

### MongoDB Connection Issues

[](#mongodb-connection-issues)

```
# Verify MongoDB extension is installed
php -m | grep mongodb

# Test connection
php artisan tinker
>>> DB::connection('mongodb')->getMongoDB()->listCollections()
```

### Platform-Specific Issues

[](#platform-specific-issues)

Check individual platform action logs:

```
tail -f storage/logs/laravel.log | grep "Brevo\|Meta\|Google"
```

Getting Started
---------------

[](#getting-started)

- **[⚡ Quick Start](QUICK-START.md)** - Get started in 5 minutes without database
- **[🔑 APP\_ID Guide](APP-ID-GUIDE.md)** - Understand application ID configuration
- **[🧪 Testing Guide](TESTING.md)** - Comprehensive testing documentation

Extensibility
-------------

[](#extensibility)

Want to add a new platform, customize behavior, or override components? The package is fully extensible!

- **[Extensibility Guide](EXTENSIBILITY.md)** - How to add new platforms, events, and decorators
- **[Override Guide](OVERRIDE.md)** - How to customize and override package behavior
- **[SQL Setup Guide](SQL-SETUP.md)** - How to use SQL instead of MongoDB

The DDD architecture makes it easy to extend and override without modifying core code.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Saleh Mehdiyev](https://github.com/salehmehdi)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Support
-------

[](#support)

For support, please open an issue on [GitHub Issues](https://github.com/mehdiyev-signal/pixel-manager/issues) or contact .

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance73

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

149d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117492764?v=4)[salehmehdi](/maintainers/salehmehdi)[@salehmehdi](https://github.com/salehmehdi)

---

Top Contributors

[![salehmehdi](https://avatars.githubusercontent.com/u/117492764?v=4)](https://github.com/salehmehdi "salehmehdi (24 commits)")

---

Tags

laravelgoogletrackingDomain Driven DesigndddmetapinterestbrevoTikTok pixelsnapchat

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mehdiyev-signal-pixel-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mehdiyev-signal-pixel-manager/health.svg)](https://phpackages.com/packages/mehdiyev-signal-pixel-manager)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
