PHPackages                             shineunited/tagmanager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. shineunited/tagmanager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shineunited/tagmanager
======================

Basic PHP container for Google Tag Manager

2.0.0(9y ago)05.7kMITPHPPHP &gt;=5.6

Since Oct 28Pushed 9y ago2 watchersCompare

[ Source](https://github.com/shineunited/tagmanager)[ Packagist](https://packagist.org/packages/shineunited/tagmanager)[ RSS](/packages/shineunited-tagmanager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (11)Used By (0)

Shine United - Tag Manager
==========================

[](#shine-united---tag-manager)

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

[![Latest Stable Version](https://camo.githubusercontent.com/4201b6558e598c3ea73e5efa224b8a7fb4d2b781e077bb23f2467edd51764109/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368696e65756e697465642f7461676d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shineunited/tagmanager)[![Minimum PHP Version](https://camo.githubusercontent.com/b52c83f3d45755ebcb1e6863ebb202ab192aaf773424369ffdeedae107f027ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e342d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/e9c8e23e481a8afecbc6bd7a26a6a88513d6de93062cc548dd80c4092d2813e1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7368696e65756e697465642f7461676d616e616765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/shineunited/tagmanager)

Installation
------------

[](#installation)

The recommended way to install Tag Manager is through [Composer](http://getcomposer.org).

#### Install Composer

[](#install-composer)

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

#### Add package to composer.json

[](#add-package-to-composerjson)

```
$ composer require shineunited/tagmanager
```

#### Update dependencies

[](#update-dependencies)

```
$ composer.phar update
```

#### Include autoloader

[](#include-autoloader)

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

Usage
-----

[](#usage)

#### Silex

[](#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

[](#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.

```

	...
	{{ gtm() }}

```

Or load the javascript and no-script snippets separately.

```

	...
	{{ gtm('head') }}

	{{ gtm('body') }}
	...

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~0 days

Total

9

Last Release

3322d ago

Major Versions

1.1.x-dev → 2.0.02017-05-30

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8301342?v=4)[Shine United](/maintainers/shineunited)[@shineunited](https://github.com/shineunited)

---

Top Contributors

[![rmlasseter](https://avatars.githubusercontent.com/u/5660821?v=4)](https://github.com/rmlasseter "rmlasseter (23 commits)")

---

Tags

googlemanagertaggtmtag manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shineunited-tagmanager/health.svg)

```
[![Health](https://phpackages.com/badges/shineunited-tagmanager/health.svg)](https://phpackages.com/packages/shineunited-tagmanager)
```

###  Alternatives

[magepal/magento2-googletagmanager

Google Tag Manager (GTM) for Magento 2 with Advance Data Layer

2691.6M5](/packages/magepal-magento2-googletagmanager)[lexik/data-layer-bundle

Manipulate the Google Tag Manager Data Layer from your Symfony application.

14114.5k](/packages/lexik-data-layer-bundle)[dmitrykazak/magento-google-tag-manager

Google Tag Manager (GTM) Extension for Magento 2

112.8k](/packages/dmitrykazak-magento-google-tag-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
