Skip to content

yiiness/yii2-googletagmanager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 GoogleTagManager

Yii2 Widget for Google Tag Manager

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist tomlutzenberger/yii2-googletagmanager "*"

or add

"tomlutzenberger/yii2-googletagmanager": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by:

<?= \TomLutzenberger\GoogleTagManager\GoogleTagManager::widget() ?>

You can either add the ID of your container to the params.php

<?php
      
return [
    // ...
    'gtmId' => YII_ENV_PROD ? 'GTM-ASDF123' : '',
];

or pass it directly to the widget:

<?= \TomLutzenberger\GoogleTagManager\GoogleTagManager::widget([
    'gtmId' => 'GTM-ASDF123'
]) ?>

License

This package is published under the MIT License and can be used for any commercial and personal projects.

About

Yii2 Widget for Google Tag Manager

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%