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

Gtm Laravel Package

awcodes/gtm

A lightweight Laravel and Filament package for adding Google Tag Manager to your app. Set your GTM container ID, inject the required scripts, and push dataLayer events without editing your Blade views—a quick, clean analytics setup.

View on GitHub
Deep Wiki
Context7

Easy integration of Google Tag Manager into your Laravel application.

Frequently asked questions about Gtm
How do I install awcodes/gtm in a Laravel application?
Install it with Composer using composer require awcodes/gtm, then publish the package config so config/gtm.php is available in your app. Set your Google Tag Manager container ID and enable the package through that config, then add the Blade components to your layout. There are no migrations or routes to run.
Where should I place x-gtm::script and x-gtm::no-script in my Blade layout?
Put x-gtm::script in the head of your layout so the GTM loader loads early, and put x-gtm::no-script immediately after the opening body tag. Those two components render the standard GTM container halves. Keep them in a shared layout so every page gets consistent tagging.
How do I set the Google Tag Manager container ID for awcodes/gtm?
The published config/gtm.php exposes gtm.id and gtm.enabled. Wire gtm.id to an environment variable per environment and keep the container ID out of Blade templates. The package renders the container ID into the GTM script and noscript iframe.
Why is Google Tag Manager not rendering after installing awcodes/gtm?
The package uses a two-level enable gate: tags render only when the component enabled prop and the gtm.enabled config value are both true. Check both values before debugging anything else. On versions before v2.0.1, also check the noscript component bug that read config('site.gtm.id') instead of the published gtm config. Upgrade to v2.0.1 if the iframe is empty.
How can I disable GTM in local, staging, or CI with awcodes/gtm?
Set gtm.enabled to false in those environments, typically through an environment variable mapped in config/gtm.php. Use the per-component enabled prop when you want to toggle tagging for specific surfaces such as the app, admin, or a Filament panel. This is a conservative safety model, so a disabled gate fails silently rather than throwing an error.
Does awcodes/gtm work with Filament panels?
Yes, the package is described as a Laravel and Filament package, and the per-component enabled prop lets you scope GTM output to particular surfaces such as app pages or Filament panels. Add the GTM components to the relevant panel or app layout. Confirm the current Filament compatibility in the package composer constraints before adopting.
Can I push dataLayer events with awcodes/gtm?
The package injects the GTM container and gives you a consistent place to load it, so you can push dataLayer events from your own application JavaScript. It does not define event schemas, validate the data layer, or provide server-side tagging. Treat it as the tag loader, not a full analytics event framework.
Does awcodes/gtm track page views on SPA or Inertia navigation?
No, the package renders the GTM container but does not push a page_view event on SPA transitions. For Inertia, Livewire, or other single-page navigation, you need to push virtual page views to the dataLayer yourself. The package is a tag renderer, not a router-aware analytics layer.
What changed in awcodes/gtm v2.0.1 and should I upgrade?
v2.0.1 fixes the x-gtm::no-script component, which previously read config('site.gtm.id') instead of the package's gtm config and could emit an empty container ID. It also adds a docs directory, per-component test assertions, and a matrix covering the enabled prop and gtm.enabled config. Upgrade if you are on v2.0.0 or earlier, especially if dashboards depend on no-JavaScript traffic. Expect a step change in reported volume for that segment after the fix.
Is awcodes/gtm worth using instead of pasting the GTM snippet manually?
The package is intentionally thin: it renders static HTML, publishes one config file, and has no migrations, routes, middleware, or queue workers. That makes it cheap to adopt and cheap to remove; replacing it is roughly pasting the same GTM snippet into a layout partial. Its main value is standardizing an auditable container ID and enable switch across Laravel and Filament layouts.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo