kpicaza / google-analytics-bundle
在模板中插入 Google Analytics 跟踪器的简单方法。
dev-master / 0.1.x-dev
2016-01-27 13:26 UTC
Requires
- php: >=5.3.0
- symfony/symfony: >=2.3
This package is auto-updated.
Last update: 2024-09-18 09:00:27 UTC
README
Twig 扩展,用于在模板中插入 Google Analytics 脚本
## 安装
composer require kpicaza/google-analytics-bundle=dev-master
然后在您的应用程序内核中激活
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new Kpicaza\Bundle\GoogleanalyticsBundle\KpicazaGoogleanalyticsBundle(),
...
## 使用
将以下辅助函数添加到您的 twig 模板中
{{ ga_init('UA-XXXXXXXX-X') }}