Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Utm Cookie Bundle

Utm Cookie Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

The UtmCookieBundle is a Symfony Bundle to save utm parameters from url into cookie when exists. Than cookie (utm) can be used later without parsing google or any other cookies.

Frequently asked questions about Utm Cookie Bundle
Can I install medelse/utm-cookie-bundle in a Laravel application?
No. medelse/utm-cookie-bundle is a Symfony bundle with a Bundle class, DI service definitions, and an HTTP kernel event subscriber. It has no Laravel service provider, config publishing, middleware registration, or facade, so it is not installable-and-usable in a Laravel codebase. Treat it as a reference implementation to port, not a dependency to require.
Does medelse/utm-cookie-bundle support Laravel 10 and Laravel 11?
There is no official Laravel support. The bundle was last released in November 2021 and likely declares PHP 7.2–8.0 and Symfony 4.4/5.x constraints, while Laravel 10 and 11 require PHP 8.1+ or 8.2+. Composer require will most likely fail on platform constraints, and forcing it installs code that has never run on your runtime. Reimplement the behavior in Laravel middleware instead.
Is medelse/utm-cookie-bundle still maintained?
It appears abandoned. The last release was November 2021, with no commits, issue triage, or security response since, and it has 0 stars and 0 dependents. That means no community review and no one else to absorb breakage. If you reuse the code, you own it and must maintain it yourself.
How do I capture UTM parameters in Laravel with middleware?
Create a middleware that reads utm_source, utm_medium, utm_campaign, utm_term, and utm_content from the query string, serializes the values, and writes a cookie with a configurable TTL. Register it on the web group or globally, add a config file for cookie name, lifetime, domain, SameSite, and first-touch versus last-touch behavior, and cover it with a feature test. The whole implementation is roughly 80–150 lines, so the bundle is only useful as a reference.
Does medelse/utm-cookie-bundle handle GDPR consent for UTM cookies?
There is no evidence of a consent hook in the bundle. A 2021 UTM utility of this size almost certainly sets the cookie unconditionally on every request. In the EU and UK, attribution cookies are non-essential under ePrivacy/GDPR and generally require consent before being set, so gate any cookie write behind a consent signal in your Laravel middleware. This is the largest legal risk in adopting the bundle.
Which UTM parameters does medelse/utm-cookie-bundle capture?
It captures the standard UTM set: utm_source, utm_medium, utm_campaign, utm_term, and utm_content, and may also handle click IDs such as gclid or fbclid. Verify the source before relying on the exact list. For your own implementation, decide explicitly whether affiliate IDs, msclkid, or other campaign identifiers are in scope.
Should UTM cookies use first-touch or last-touch attribution?
First-touch attribution preserves the original campaign values and does not overwrite them on later visits. Last-touch attribution overwrites the cookie each time a new campaign visit arrives. The bundle encodes one of these decisions, but marketing stakeholders must pick it explicitly. Implement the chosen behavior deliberately in your middleware rather than inheriting an assumption.
How do I configure and secure a UTM cookie in Laravel?
In Laravel, put cookie name, TTL, domain scope, SameSite, Secure, and HttpOnly settings in a config file and read them from middleware. Use Secure and SameSite=Lax or Strict where appropriate, and set HttpOnly if only the server needs to read the cookie. Keep the payload small because five UTM values plus click IDs can reach several hundred bytes and push toward the roughly 4KB per-domain browser limit. Match the cookie name and payload shape to what your analytics stack or CRM already expects.
How should I test UTM cookie capture in a Laravel application?
Write a Laravel feature test that sends a request with UTM query parameters and asserts the cookie is queued or set with the expected payload. Add cases for consent gating, first-touch versus last-touch behavior, TTL, and domain or SameSite configuration. Laravel's cookie assertions make this straightforward, and you do not need the Symfony bundle to test the behavior.
What alternatives to medelse/utm-cookie-bundle should Laravel developers consider?
The main alternatives are a small custom Laravel middleware, a client-side tag manager or analytics script, or a consent-aware tracking package that fits your stack. A custom middleware is usually best because it is short, testable, and avoids an abandoned Symfony dependency with unresolved PHP constraints. If a tag manager already sets a UTM cookie, inventory it first so your server-side implementation does not silently overwrite or conflict with it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons