Google Tag Manager - v1.0.0

FAQ

Do I need the base google package to use the snippet?

No. The @gtmSnippet directive and the React/Vue snippet components work standalone with just GTM_CONTAINER_ID set. The base package is only needed for the server-side Tag Manager API and the admin components (container overview, tag list).

Do I need to run migrations for this package?

No — this package does not add any tables. It reuses the base package's google_connections table.

Why am I getting a 403 on every API call even after the user consented?

Two things need to be true:

  1. The tagmanager.readonly scope must be added on the OAuth consent screen in the Google Cloud Console (this package contributes it to the base package's scope registry, but Google's consent screen must know it too).
  2. The Tag Manager API must be enabled under APIs & Services → Library. Enabling the scope is separate from enabling the API.

Both are required. See Google base package.

The Livewire component renders "Google not connected" but the user IS connected

Check the GoogleConnection.status column — it must be 'connected'. disconnected or revoked statuses render the connect-CTA state.

Also check that the connection has tagmanager.readonly in granted_scopes. If it's missing, the user connected before the package was installed — they need to reconnect to pick up the new scope on the consent screen.

How do I disable the client-side snippet for local development?

Either omit GTM_CONTAINER_ID in your local .env, or set google-tag-manager.snippet.enabled to false. Both cause the Blade directives to render nothing without changing your templates.

Can I use a proxied gtm.js URL?

Not via config — the shipped SnippetRenderer hard-codes https://www.googletagmanager.com/gtm.js. Extend the class, rebind the singleton in your own service provider, or write your own directive if you need a proxied URL.

Does this package support write operations (edit tags, publish containers)?

Not in v1. The v1 scope is tagmanager.readonly. A future major release may add opt-in write scopes and mutations; the read-only surface is the entire v1 API contract.

What Google Tag Manager API version does this use?

v2. See the API reference.

Why is my container overview stale after updating a tag?

Successful API responses are cached at google-tag-manager.api.cache_ttl seconds (default 300). Either wait, set cache_ttl to 0 in config, or clear the cache manually: php artisan cache:clear.

Are Livewire, React, and Vue components mutually exclusive?

No. All three read from the same backend fetchers via HTTP routes (React / Vue) or direct fetcher calls (Livewire). Use whichever fits each page — a Blade admin panel with a Livewire container overview and a React-based tag list is perfectly fine.

How do I customize the shipped Blade views without forking the package?

Publish them:

php artisan vendor:publish --tag=google-tag-manager-views

Edit resources/views/vendor/google-tag-manager/livewire/*.blade.php. The Livewire class contract is unchanged, so your markup works with the same actions and state.