medelse/utm-cookie-bundle
A Symfony bundle that stores UTM campaign parameters in a cookie so attribution data survives across requests and redirects. It captures traffic source details and keeps them available for later tracking, lead attribution, or analytics.
Architecture fit — poor, and the framing needs correcting first. Despite the brief describing this as a "Laravel/PHP package," medelse/utm-cookie-bundle is a Symfony Bundle. It ships a Symfony Bundle class, DI service definitions, and an event subscriber bound to Symfony's HTTP kernel lifecycle. There is no Laravel service provider, no config publishing, no middleware registration, and no facade. In a Laravel codebase it is not installable-and-usable; it is raw material to be read and ported.
The underlying capability is also very small: intercept a request, read a fixed set of query parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content, plus possibly gclid/fbclid), serialize them, and write a cookie with a configurable TTL. This is on the order of 80–150 lines of application code. The value of the package is therefore almost entirely in the decisions it encodes (which params, first-touch vs. last-touch, cookie name and lifetime, encoding), not in the code volume.
Integration feasibility — technically easy, commercially pointless. A Laravel equivalent is a single global or web-group middleware plus a config file. Any mid-level Laravel engineer can reproduce and improve on this in under a day, with tests. Porting the bundle as-is would mean translating Symfony event subscriber semantics into Laravel middleware and inheriting its assumptions uncritically.
Technical risk — high, concentrated in maintenance and compliance.
composer require will most likely fail on platform constraints — and forcing it installs code that has never been executed against the runtime we would deploy it on.Secure, SameSite, or HttpOnly handling beyond Symfony defaults.Key questions to resolve before any decision:
gclid, fbclid, msclkid, affiliate IDs?SameSite policy — do these match our existing analytics stack?composer.json, and does it resolve on our runtime?Stack fit — do not adopt as a dependency. The correct integration approach for a Laravel application is reimplement, using the bundle only as a reference implementation. Read it, extract the parameter list and cookie conventions, then write idiomatic Laravel: one middleware, one config file, one feature test.
Migration path:
Secure, SameSite=Lax, not HttpOnly if front-end JS must read it).app/Http/Middleware/CaptureUtmParameters.php, registered on the web group, reading $request->query() against an allowlist and writing via Laravel's cookie API. Store a timestamp and a source-of-truth marker in the payload.Compatibility: treat the Symfony bundle as incompatible-by-default with Laravel 10/11. If a team insists on vendoring it, expect to fork and rewrite — at which point the fork is the codebase you maintain, and the package contributes only its original design choices.
Sequencing: consent policy → attribution spec (marketing sign-off) → middleware implementation → analytics/CRM consumer validation → rollout behind a flag → measurement. Do not start with the package; it is the least important input.
Maintenance — the burden transfers fully to us. With no upstream, any bug, PHP deprecation, or Laravel upgrade breakage is our problem. The realistic maintenance load for a self-written middleware is near zero; for a vendored abandoned Symfony bundle it is a permanent fork-owner obligation disproportionate to 100 lines of functionality. Opportunity cost is the decisive argument: the cost of writing this exceeds the cost of owning this package within roughly one upgrade cycle.
Support — nonexistent. No maintainer response, no issue history, no documentation beyond a README. Internal engineers cannot escalate. Any incident is entirely first-line.
Scaling — negligible on the happy path, watch the edges. One cookie read and one Set-Cookie per request is trivially cheap; no database, cache, or external call. The real scaling concerns are: (a) cookie size growth as parameters and click IDs accumulate, and (b) header size at the CDN/edge if the cookie is forwarded on every request — ensure it is scoped narrowly and consider excluding it from edge cache keys.
Failure modes to design against:
utm_source replaces a high-value paid attribution record.Ramp-up — low for the work, high for the context. Any Laravel engineer can implement this in half a day. The actual ramp-up cost is cross-functional: aligning marketing, legal/privacy, and analytics on touch semantics and consent gating typically takes longer than the code. Budget days for the spec and hours for the build.
Recommendation: do not adopt medelse/utm-cookie-bundle. Close it at intake on stack mismatch (Symfony vs. Laravel) and abandonment (2021, 0 dependents, 0.22 score). Deliver the same capability as first-party Laravel code with consent gating and tests, using the bundle's README only to confirm the parameter list. Revisit only if the organization standardizes on Symfony, and even then the package's staleness argues for in-house implementation.
How can I help you explore Laravel packages today?