henryavila/email-tracking
Laravel package for email tracking that monitors opens and link clicks by injecting tracking pixels, rewriting URLs, and recording engagement events, with per-message analytics to help measure campaign performance.
Architecture fit. henryavila/email-tracking is a Laravel-native package that hooks into Illuminate\Mail\Events\MessageSent to persist outbound email metadata (recipients, subject, message IDs, and now email type classification). Architecturally it is a thin, event-driven sidecar to Laravel's mail subsystem — it does not wrap or replace the mailer, which keeps it low-coupling. The v7.0.0 addition of typed classification (supporting both BackedEnum and string values) is the most product-relevant change: it converts the package from a raw audit log into a filterable analytics substrate (transactional vs. marketing vs. notification), which materially improves downstream reporting and deliverability segmentation.
Integration feasibility. Straightforward if and only if the host application is already on Laravel 11+. Installation remains a single composer require plus event registration. The one non-trivial integration detail is the event registration pattern change: Laravel 11 removed the default EventServiceProvider::$listen convention, so teams must move the listener registration into AppServiceProvider::boot() via Event::listen(...). This is a silent-failure risk — a missed registration means tracking simply stops, with no error. Any team on Laravel 9/10 faces a much larger prerequisite: a full framework upgrade before this package can move at all.
Technical risk.
Key questions.
henryavila/email-tracking on the critical path (compliance/audit, deliverability, customer-facing email history) or purely observational? Critical-path status changes the risk posture significantly.henryavila) projects carry succession risk regardless of test coverage.MessageSent path (queued batches, third-party transports, notifications bypassing the mailer) that would remain untracked?Stack fit. Requires PHP 8.2/8.3/8.4 and Laravel 11 or 12. Explicitly drops PHP 8.1, Laravel 9.x, and Laravel 10.x. This aligns the package with Laravel 11 LTS and Laravel 12 — the correct long-term target — but it is a hard gate, not a soft preference. The package is a natural fit for any Laravel monolith or modular monolith that already sends mail through Laravel's mailer and wants audit/analytics without adopting an external ESP's tracking stack.
Migration path. Treat this as a two-track rollout:
composer require henryavila/email-tracking:^7.0, then rewrite the listener registration from EventServiceProvider::$listen into AppServiceProvider::boot() using Event::listen(...).Compatibility. The package is well-validated across the supported matrix (PHP 8.2–8.4 × Laravel 11/12, Ubuntu and Windows), which reduces "works on my machine" risk. The residual compatibility surface is the application's own customizations: any local overrides of the package's models, migrations, or listener, and any custom mail transport that bypasses MessageSent.
Sequencing. Strictly ordered: (1) PHP upgrade → (2) Laravel 11 upgrade and stabilization → (3) package v7 upgrade with event-registration rewrite → (4) staging verification of tracking writes → (5) production rollout with a monitoring window → (6) email-type classification as a discrete follow-up. Attempting to collapse (1)–(3) into one change set is the primary way this goes wrong.
Maintenance. Low ongoing surface area: event-driven, no long-running processes, no external service dependency, no daemon to babysit. The maintenance cost is concentrated almost entirely in the upgrade event itself. The package's own engineering hygiene (Pest 3, PHPUnit 11, PHPStan L4, Pint, Codecov) suggests the maintainer intends to keep pace with Laravel releases — a positive signal for staying current. Counterweight: it is a single-maintainer community package, so budget for the possibility of taking a fork or vendored patch if the maintainer steps away or lags on Laravel 13.
Support. Documentation was meaningfully improved in this release — a step-by-step upgrade guide, Laravel 11-pattern examples, and clearer README. That reduces internal support load. However, support during the migration window will be elevated: the failure mode (missing event registration) is silent and will generate "why did tracking stop?" investigations unless engineering pre-empts it with a documented verification step and an alert on tracking-record volume.
Scaling. Tracking writes are one insert per sent email, synchronous with the mail event unless the listener is queued. At high mail volumes this adds write pressure to the primary database and can add latency to the send path. Recommended mitigations: queue the listener if not already queued, and plan retention/archival on the tracking table (it grows monotonically and is rarely needed hot beyond 90–180 days). Email-type classification improves query ergonomics but also adds an indexed-column consideration if used as a primary filter in dashboards.
Failure modes.
EventServiceProvider::$listen registration — the highest-probability failure and the hardest to notice. Mitigate with a synthetic send in staging plus a production alert on tracking-row volume dropping to zero.Ramp-up. For a team already on Laravel 11: roughly a half-day to one day — composer bump, one event-registration edit, a migration check, and a staging verification. For a team on Laravel 10 or below: dominated entirely by the framework upgrade, realistically one to several weeks depending on application size and third-party dependency readiness. The package itself is not the work; the platform uplift is. Recommended ownership: an engineer familiar with the mail subsystem for the integration, with TPM-level tracking of the Laravel 11 prerequisite as a separate, explicitly-funded milestone so the package upgrade is never mistaken for a routine patch release.
How can I help you explore Laravel packages today?