Google Tag Manager - v1.0.0

CMS Framework Widgets

When the artisanpack-ui/cms-framework package is installed, the container overview and tag list components are automatically exposed as CMS admin dashboard widgets.

The wrappers (ContainerOverviewWidget and TagListWidget) extend the underlying Livewire components and implement the CMS framework's AdminWidgetInterface, so instantiating a widget via the CMS AdminWidgetManager renders the same UI as <livewire:google-tag-manager::container-overview />.

Automatic registration

When both artisanpack-ui/cms-framework and livewire/livewire are installed, the service provider:

  1. Registers both wrapper classes with the CMS's AdminWidgetManager under the keys google-tag-manager-container-overview and google-tag-manager-tag-list.
  2. Registers them as Livewire components under google-tag-manager::cms-container-overview-widget and google-tag-manager::cms-tag-list-widget so the CMS dashboard can render them.

If either peer package is missing, registration silently no-ops — the wrappers only make sense with both.

Widget metadata

Each wrapper exposes a getWidgetInfo() static method returning:

[
    'title'           => __( '...' ),
    'description'     => __( '...' ),
    'capability'      => 'view_tag_manager',
    'default_options' => [
        // per-widget defaults
    ],
]

The capability is view_tag_manager — configure it on your CMS role/capability matrix or override the widget class if you want a different capability name.

default_options starts empty for account/container/workspace IDs — the CMS admin fills them in per-widget when adding to the dashboard.

Overriding

To ship your own widget instead:

namespace App\Widgets;

use ArtisanPackUI\CMSFramework\Modules\AdminWidgets\Contracts\AdminWidgetInterface;
use ArtisanPackUI\GoogleTagManager\Livewire\ContainerOverview;

class MyContainerWidget extends ContainerOverview implements AdminWidgetInterface
{
    public static function getWidgetInfo(): array
    {
        return [
            'title'       => 'My container',
            'description' => 'Overview for the marketing container',
            'capability'  => 'view_marketing_analytics',
            'default_options' => [
                'accountId'   => env( 'GTM_MARKETING_ACCOUNT_ID' ),
                'containerId' => env( 'GTM_MARKETING_CONTAINER_ID' ),
                'workspaceId' => null,
            ],
        ];
    }
}

Register with the CMS from your own service provider:

$manager = $this->app->make( \ArtisanPackUI\CMSFramework\Modules\AdminWidgets\Services\AdminWidgetManager::class );
$manager->register( 'my-container-widget', \App\Widgets\MyContainerWidget::class );