protonemedia/laravel-analytics-event-tracking
Laravel Analytics Event Tracking lets you track user events and page views in your Laravel app, storing them locally or sending them to Google Analytics. Simple configuration, middleware support, and a clean API for logging custom events.
Architecture fit. From a program standpoint, the package occupies a favorable architectural position: it is a thin Laravel-native wrapper over a server-side analytics transport, exposing an Analytics facade, config-driven provider credentials, an event-mapping layer, and queued dispatch so tracking never sits on the request's critical path. It introduces no persistence, no schema, and no domain model — meaning it does not create a migration or data-ownership commitment, and it can be removed without data remediation. That is the profile of a low-coupling, swappable dependency, which is what a TPM wants in a non-differentiating capability. The complication is that architecture fit and lifecycle fit diverge here: the repository is archived, last released 2023-02-21 (1.6.0), carries zero dependents, and will receive no further releases. Design-wise it is adoptable; support-wise it is frozen.
Integration feasibility. Mechanically trivial (composer require, auto-discovery, publish config, dispatch one event), but the TPM-relevant feasibility question is against which baseline. The 1.6.0 floor is Laravel 10 / PHP 8.1+ (it explicitly dropped PHP 8.0 as a minor-version change — a semver-hygiene data point). Laravel 11 and 12 have since shipped and will never be officially supported. Feasibility therefore reduces to three options, each with a distinct owner and cost: (a) pin to Laravel 10, (b) run unsupported on a newer major, or (c) fork. The gating technical question is GA4. Universal Analytics was sunset in July 2023; GA4 uses Measurement Protocol v2 with a materially different payload shape. A February-2023 package may emit UA-era payloads, and Measurement Protocol accepts and silently discards invalid events — a failure mode with no error signal, which is precisely the kind of risk that must be resolved by a spike, not by assumption.
Technical risk.
Key questions.
composer.json constraints on php and illuminate/support — does it hard-block Laravel 11/12, or merely leave it untested?Stack fit. A clean fit only for teams intentionally standardized on Laravel 10 / PHP 8.1+ with an explicit appetite for a frozen dependency. It is a poor fit for teams on Laravel 11/12, teams with a forward upgrade cadence, or organizations whose policy bars unmaintained packages (most). The defensible program position for the majority of orgs: do not adopt as a durable upstream dependency — adopt as a reference implementation or a time-boxed bridge behind our own interface.
Migration path. Frame this as a containment plan, with the internal interface — not the package — as the deliverable:
AnalyticsGateway as an internal contract owned by us. Every call site depends on our interface; the package is an implementation detail behind it.Compatibility. Both floor and ceiling are fixed by archive status: nothing below Laravel 10, nothing officially above it, and GA4 compatibility is unproven until demonstrated. Any Laravel 11/12 usage is unsupported and fork-owned — that must be recorded in the dependency register, not assumed.
Sequencing. Protocol validation → internal interface/adapter → fork and vendor → single-feature canary (one high-value event, e.g. trial start) → broaden to the 5–10 decision-driving events. Critically, decouple this work from any framework upgrade: because the package cannot move with the framework, coupling the two converts a routine Laravel upgrade into a blocked milestone. Run them as separate workstreams with separate owners and dates.
Maintenance. This is the dominant cost and the item most often mis-scoped. Archive status means no upstream maintenance: every framework bump, GA4 protocol change, dependency CVE, and bug fix is ours. The buy-vs-build economics invert — we capture the initial development savings and then own the entire maintenance tail. Resource the fork as an explicit, named line item with an accountable owner; do not let it decay silently in the dependency tree, where it will surface during an unrelated incident.
Support. There is no upstream support channel, no security advisories, and no upgrade guides. Operational hygiene requires: a named owner, a pinned and documented version, documented fork deltas against upstream, and a written replacement trigger. Without those four artifacts, this becomes orphaned technical debt with no discovery path until it breaks.
Scaling. Runtime scaling is a non-issue: dispatch is queued, so throughput tracks worker capacity, and the outbound call is a simple HTTP request to the Measurement Protocol endpoint. The real scaling constraints are analytics volume and endpoint rate limits, plus the silent-drop behavior — at volume, an invalid or throttled payload looks identical to a successful send in application logs. Mitigate with queue-level retry/backoff, a dead-letter queue, and outbound payload sampling or a reconciliation check against GA4 rather than relying on HTTP 200 as proof of delivery.
Failure modes. Rank them for the risk register:
Ramp-up. Low engineering ramp (clean facade, published config, familiar Laravel idioms; roughly a sprint-day to fork and harden). The organizational ramp is the real cost: establishing PII guardrails and an event allow-list at the gateway layer, agreeing event taxonomy ownership with product analytics, and getting legal/privacy sign-off on what leaves our servers. Sequence that governance work in parallel with the technical spike, not after it — it is the longer pole and it determines whether the canary can ship at all.
How can I help you explore Laravel packages today?