dorsetdigital / silverstripe-simplegtag
添加 GTM 标签的简单方法
v2.0.2
2024-07-10 06:04 UTC
Requires
- silverstripe/cms: ^4.0 | ^5.0
Suggests
- bramdeleeuw/cookieconsent: Cookie consent module
README
一种非常简单的方法,用于向网站添加 Google 标签,用于分析、广告等。
要求
*Silverstripe 4.x
安装
- 使用
composer require dorsetdigital/silverstripe-simplegtag
安装代码 - 运行
dev/build?flush
以更新您的项目
使用方法
此模块将所需的代码注入到您的页面中,用于 Google Tag Manager。安装后,请在网站配置中设置您的 GTM ID。
该模块在 <head>
中注入代码,并在 <body>
开始处注入 <noscript>
片段。
同意
如果您使用的是cookie同意模块(https://github.com/TheBnl/silverstripe-cookie-consent),则此模块仅在用户接受分析cookie的情况下添加 GTM 标签。