Google Tag Manager - v1.0.0

HTTP Routes

The package registers two HTTP routes that back the React and Vue components. Both are registered only when the base package is installed and google-tag-manager.routes.enabled is true.

Prefix: google-tag-manager.routes.prefix (default google-tag-manager) Middleware: google-tag-manager.routes.middleware (default [ 'web', 'auth' ])

GET /{prefix}/container-overview

Route name: google-tag-manager.container-overview Controller: ContainerOverviewController (single-action)

Query parameters:

Name Type Required Purpose
account_id string Yes GTM account ID
container_id string Yes GTM container ID
workspace_id string No Specific workspace; defaults to the container's default workspace

Responses:

  • 200 OKContainerOverviewData::toArray() payload
  • 401 Unauthorized — user is unauthenticated (from auth middleware, or missing session)
  • 409 Conflict — user has no GoogleConnection or its status is not connected
  • 422 Unprocessable Entityaccount_id or container_id is missing
  • 501 Not Implemented — base package is not installed
  • 502 Bad Gateway — upstream Tag Manager API error or transport failure

GET /{prefix}/tags

Route name: google-tag-manager.tags Controller: TagListController (single-action)

Query parameters:

Name Type Required Purpose
account_id string Yes GTM account ID
container_id string Yes GTM container ID
workspace_id string Yes Workspace ID

Responses match the container overview endpoint (401 / 409 / 422 / 501 / 502) with TagListData::toArray() on success.

Error payload shape

Non-200 responses return JSON in the shape:

{ "error": "not_connected", "message": "..." }

error is a snake-case code the React and Vue clients read to differentiate between error states (see React). The full set:

HTTP status error code When
401 unauthenticated No authenticated user
409 not_connected User has no connected Google account
422 invalid_request Missing / invalid query parameters
501 base_not_installed Base google package missing (also emits baseInstalled: false)
502 api_error Upstream Tag Manager API returned an error, or transport failure

Route script directive

Because the prefix is configurable, the shipped React and Vue components need to know where the routes actually live at runtime. The @gtmRoutes Blade directive emits:

<script>window.__apGtmRoutes = { containerOverview: '...', tags: '...' };</script>

Include it in your Blade layout before your JS bundle. Explicit baseUrl props on the components override this.