ezoterik/yii2-google-tag-manager

Google Tag Manager extension for the Yii2 framework

Installs: 60 710

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 4

Open Issues: 1

Type:yii2-extension

1.0.3 2018-10-27 13:40 UTC

This package is auto-updated.

Last update: 2021-08-27 20:35:48 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

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');