Add Google Tag Manager to Magento
composer.json for other requirements.
Use composer to install this extension. First make sure that Magento is installed via composer, and that there is a valid
composer.json file present.
Next, install our module using the following command:
composer require yireo/magento2-googletagmanager2
Next, install the new module into Magento itself:
./bin/magento module:enable Yireo_GoogleTagManager2 ./bin/magento setup:upgrade
Check whether the module is succesfully installed in Admin > Stores > Configuration > Advanced > Advanced.
Original extension versions started at version 0.0.1, which probably means that your
composer.json matches versions as follows:
This excludes upgrades towards the new major version 1.0 and higher. To fix this, use the following command:
composer require yireo/magento2-googletagmanager2:^1.0
composer to install this package. If you want a manual copy instead, these are the steps. However, please note that we do NOT recommend you to do this.
source/folder to the folder
app/code/Yireo/GoogleTagManager2of your site
php -f bin/magento module:enable Yireo_GoogleTagManager2
php -f bin/magento setup:upgrade
Stores > Configuration > Sales > Yireo GoogleTagManager
This extension ships with PHPUnit tests. The generic PHPUnit configuration in Magento 2 will pick up on these tests. To only test Yireo extensions, simply run PHPUnit from within this folder. Note that this assumes that the extension is installed via composer. For instance:
npm install npm run mocha
Or just use
yarn npm run mocha