la-haute-societe / craft-google-tag-manager
Configure the Google Tag Manager "Container ID" from the Craft CMS control panel
Installs: 18 222
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 7
Forks: 1
Open Issues: 2
Type:craft-plugin
Requires
- craftcms/cms: ^4.0.0
This package is auto-updated.
Last update: 2024-10-16 08:03:04 UTC
README
This plugin allows you to configure the "ContainerID" from the control panel and inject the GTM tags into the template.
Requirements
This plugin requires Craft CMS 4.0.0 or later. Version 1.x of this plugin supports Craft CMS 3.x.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require la-haute-societe/craft-google-tag-manager
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Google Tag Manager.
Configuring Google Tag Manager
You can configure the containerID from the Craft Control Panel.
Using Google Tag Manager
Copy the code below and paste it into your layout as high as possible in the <head>
section
of the page:
{{ craft.googleTagManager.headSection() }}
You must also paste this code immediately after the opening tag <body>
:
{{ craft.googleTagManager.bodySection() }}