xynnn/google-tag-manager-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xynnn/google-tag-manager-bundle

Composer 安装命令:

composer require xynnn/google-tag-manager-bundle

包简介

Google Tag Manager Bundle for Symfony

README 文档

README

Software License Build Status Scrutinizer Quality Score Join the chat at https://gitter.im/GoogleTagManagerBundle/Lobby

The GoogleTagManagerBundle provides you an easy-to-use method to integrate the Google Tag Manager into your Symfony 2 application.

Note: This Bundle is still in development. Feel free to report encountered issues!

Requirements

2.x

  • PHP 5.3 and higher
  • Symfony 2.8 and higher

3.x

  • PHP 5.6 and higher
  • Symfony 2.8 and higher

Install

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

2.x

$ composer require xynnn/google-tag-manager-bundle "~2.0"

3.x

$ composer require xynnn/google-tag-manager-bundle "~3.0"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Xynnn\GoogleTagManagerBundle\GoogleTagManagerBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Enable Google Tag Manager

Add the configuration to your yaml file. Please don't forget to adjust your Google Tag Manager Id.

Step 4: Insert the ViewHelper

Insert the ViewHelper into your layout file to enable the Google Tag Manager. Please be aware to insert into right after the HTML body tag!

<body>
{{ google_tag_manager_body() }}
...
</body>

And right after the HTML head tag:

<head>
{{ google_tag_manager_head() }}
...
</head>

And right before the closing BODY tag:

{{ google_tag_manager_body_end() }}
</body>

Or use the autoAppend setting to let a kernel reponse listener add them to your layout automatically.

Additional instructions: https://developers.google.com/tag-manager/quickstart

Step 5: Fill up the DataLayer from Google Tag Manager (Optional)

If you want to send some information to the Google Tag Manager, you can use the dataLayer.

/** @var GoogleTagManagerInterface $manager */
$manager = $this->get('google_tag_manager');
$manager->setData('example', 'value');

And if you want to add pushes at the end of the body (not in initial dataLayer):

/** @var GoogleTagManagerInterface $manager */
$manager = $this->get('google_tag_manager');
$manager->addPush(['test' => 123);

Configuration

google_tag_manager:
    enabled: true
    id: "GTM-XXXXXX"
    autoAppend: true|false

An optional paramater called additionalParamaters allows specifying URL parameters to add on to the tag manager URLs. This can be used to support custom environments in tag manager.

google_tag_manager:
    additionalParameters: gtm_auth=XXXXXXXXXXXXX&gtm_preview=env-30&gtm_cookies_win=x

Authors

Philipp Bräutigam

... and Contributors!

License

Copyright (c) 2017 Philipp Bräutigam This repository is released under the GNU LGPL v3.0 license.

xynnn/google-tag-manager-bundle 适用场景与选型建议

xynnn/google-tag-manager-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 743.98k 次下载、GitHub Stars 达 27, 最近一次更新时间为 2015 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「tag manager」 「Google Tag Manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 xynnn/google-tag-manager-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xynnn/google-tag-manager-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 xynnn/google-tag-manager-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 743.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 18
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 3
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2015-04-11