shineunited/tagmanager 问题修复 & 功能扩展

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

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

shineunited/tagmanager

最新稳定版本:2.0.0

Composer 安装命令:

composer require shineunited/tagmanager

包简介

Basic PHP container for Google Tag Manager

README 文档

README

A basic PHP abstraction for Google Tag Manager container and datalayer.

Latest Stable Version Minimum PHP Version Build Status

Installation

The recommended way to install Tag Manager is through Composer.

Install Composer

$ curl -sS https://getcomposer.org/installer | php

Add package to composer.json

$ composer require shineunited/tagmanager

Update dependencies

$ composer.phar update

Include autoloader

include(__DIR__ . '/../vendor/autoload.php');

Usage

Silex

To use Tag Manager with Silex, register the service provider

use ShineUnited\TagManager\Silex\TagManagerServiceProvider();

$app->register(new TagManagerServiceProvider(), [
	'gtm.options' => [
		'id'      => 'GTM-XXXX', //gtm container id (required)
		'persist' => true,       //persist datalayer in session if true (optional, defaults to false)
		'varname' => 'gtm'       //session varname (optional, defaults to 'gtm')
	]
]);

Adding messages to the datalayer

$app['gtm.datalayer']->push([
	'event'     => 'gtm.eventName',
	'eventData' => [
		// event data goes here
	]
]);

Twig

The extension adds the 'gtm()' function to the Twig environment. Note: the silex service provider will automatically install the twig extension if twig is present.

<html>
<body>
	...
	{{ gtm() }}
</body>
</html>

Or load the javascript and no-script snippets separately.

<html>
<head>
	...
	{{ gtm('head') }}
</head>
<body>
	{{ gtm('body') }}
	...
</body>
</html>

统计信息

  • 总下载量: 5.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固