simonridley/tracking-code-manager
A Laravel package for centrally managing tracking codes such as Google Analytics and other analytics snippets. Configure and inject tracking scripts without hardcoding them into your views, keeping analytics setup consistent and easy to update.
Package context. simonridley/tracking-code-manager is a Statamic addon (Statamic runs on Laravel, so it ships as a standard Composer package with a service provider, config, routes, and CP views). Its function is narrow and well-understood: let editors register tracking snippets (GA4, GTM, Meta pixel, etc.) in the Control Panel and inject them into rendered site output, typically via an Antlers tag/partial and per-environment or per-site scoping.
Architecture fit. Good. The addon follows the conventional Statamic addon shape — no separate datastore, no external service dependency, config-driven, output-only. That means it sits at the edge of the render pipeline rather than in the request/domain path. For a TPM this is the cheapest possible integration class: no data model ownership, no write paths, no queue or job surface.
What v1.0.2 actually changes. A single PR (#8) updates cp.php routes to use "the right middleware," released as a patch with the headline "Fixes for Statamic 4." Reading between the lines: the Control Panel routes were previously registered with incomplete/incorrect middleware under Statamic 4, which in a CP context means authorization and web-session middleware. This is a correctness and potentially a security-adjacent fix, not a feature. It also confirms the addon was effectively broken or degraded on Statamic 4 until now.
Technical risk. Low-to-moderate, mostly non-technical:
Key questions to resolve before adoption:
Statamic::cp()-style auth/web, and does it now correctly enforce CP authorization for non-super users?php artisan config:cache, route:cache)?Stack fit. Clean. Install is composer require simonridley/tracking-code-manager, publish config, add the Antlers tag or partial to the layout. No database migrations expected, no external credentials, no API calls. It occupies a slot we would otherwise fill with hand-rolled Antlers conditionals and a YAML/blueprint — so it replaces bespoke code rather than adding a new dependency class.
Migration path.
^1.0.2 explicitly. Do not allow ^1.0.0, since 1.0.0/1.0.1 carry the broken CP routes on Statamic 4.<head> output before switching off the old include.Compatibility. Confirm the Statamic major version on each property before rollout; this release is explicitly a Statamic 4 fix, so treat Statamic 3 sites as a separate decision with a separate version constraint. Verify PHP version against the addon's composer.json rather than the README.
Sequencing.
config:cache, route:cache, and Statamic's static/content caches; confirm the tag renders and that CP routes still resolve.<head>.Maintenance. Minimal ongoing effort — config and content data only, no schema, no scheduled jobs. The real maintenance cost is dependency hygiene: pin the version, watch the repo for Statamic 5 readiness, and be prepared to vendor or fork if the maintainer goes quiet. Given the single-maintainer profile, a fork is a realistic contingency for a package this small.
Support. Community-only: GitHub issues, no SLA, no security disclosure process documented in the release notes. Set internal expectations accordingly; do not treat vendor responsiveness as an input to the timeline. Assign an internal owner so CP questions from editors don't dead-end.
Scaling. Output injection is O(1) per request and effectively free. The scaling concerns are all caching-related, not compute-related:
Failure modes to design for.
script-src.Ramp-up. Low. Developers need ~30 minutes (Composer install, config publish, Antlers tag placement). Editors need a short walkthrough of the CP form and the environment/site scoping rules — the main risk is an editor pasting a production tag into staging or duplicating a snippet across sites. Budget half a day total including the CSP and consent review, which is the only part that requires cross-team coordination.
How can I help you explore Laravel packages today?