tattali/utm-cookie-bundle
tattali/utm-cookie-bundle captures UTM parameters from incoming URLs and stores them in cookies, so your app can attribute visits, signups, or conversions to the right campaign long after the first click. Simple setup and configurable cookie lifetime for PHP apps.
utm_source, utm_medium, utm_campaign, utm_term, utm_content (plus landing page and timestamp) to user, lead, and order models, and whether those fields ship in v1 or behind a flag.tattali is a Symfony author; bundle + DI + config semantics). On a Laravel codebase the honest decision is "reimplement in a Laravel middleware," using this repo as a reference spec.Consider it when:
Look elsewhere / do not adopt as a dependency when:
SameSite, Secure, HttpOnly, cookie-name versioning, size limits (five UTMs plus landing page and referrer can push past comfortable limits), and PII hygiene in query strings.Minimum due diligence before any adoption: read every source file, confirm test presence, check PHP and framework version constraints, confirm no network calls or telemetry, and confirm the cookie write path honors consent.
For executives (30 seconds): We lose attribution the moment a visitor navigates past the landing page — campaign parameters vanish from the URL, so the signup that follows can't be traced to the ad that paid for it. This package is a small, MIT-licensed helper that captures those parameters into a cookie and hands them back at conversion time. It is cheap to evaluate and cheap to replace. The real recommendation is not "buy a tool," it's "close the attribution gap this quarter." The pattern is a half-day of engineering; we should own it either way rather than depend on an unmaintained package.
For engineering: The scope is a request middleware that parses UTM query params, writes a scoped/SameSite/Secure cookie with a defined TTL and first-touch-vs-last-touch rule, and a small accessor to read values at conversion. This repo is Symfony-shaped and has zero external adoption, so treat it as a spec, not a dependency: port the logic to a Laravel middleware (or a Symfony service if that's the stack), add tests for param parsing, overwrite policy, expiry, and consent gating, and keep the cookie name versioned so we can migrate later. Estimated effort: 1–2 days including tests and consent integration.
Recommendation: Run a one-day spike. If the stack is Symfony and the code audits clean, vendor a fork under our namespace. If the stack is Laravel, skip the dependency and implement the middleware directly. Either way, ship behind a feature flag, gate on consent, and route the captured values into the lead/order record so the data is queryable — a cookie nobody reads is not attribution.
How can I help you explore Laravel packages today?