Skip to content

hellfish2/yii2-google-tag-manager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Tag Manager extension for the Yii2 framework

Integration Google Tag Manager in your application

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ezoterik/yii2-google-tag-manager "*"

or add

"ezoterik/yii2-google-tag-manager": "*"

to the require section of your composer.json file.

Usage

  1. Add this code in your @app/config/main.php config file with the other previous config:
'bootstrap' => ['googleTagManager'],
'components' => [
    'googleTagManager' => [
        'class' => 'ezoterik\googleTagManager\GoogleTagManager',
        'tagManagerId' => 'GOOGLE_TAG_MANAGER_ID', //Your Google Tag Manager ID without "GTM-" prefix
    ],
],
  1. You can generate events:
Yii::$app->googleTagManager->dataLayerPushItemDelay('event', 'example_event');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%