The Magento 2 GTM Data Layer Module is a custom module that allows you to manage the Google Tag Manager (GTM) data layer in your Magento 2 store. It provides a flexible and extensible solution for adding data to the data layer, which can be used for various tracking and analytics purposes.
- Seamless integration with Google Tag Manager
- Easy management of data layer variables
- Customizable event-based triggers for populating the data layer
- Extensible architecture for adding additional functionality
- Magento 2.x
- Google Tag Manager account
- Clone or download this repository.
- Extract the contents and copy the
VendorName
directory into theapp/code
directory of your Magento installation. - Run the following CLI commands from your Magento 2 root directory:
bin/magento module:enable VendorName_GtmDataLayer
bin/magento setup:upgrade
bin/magento cache:clean
- Log in to the Magento admin panel and configure the module settings under Stores > Configuration > GTM Data Layer.
- Customize the module as per your requirements by modifying the observer class and configuration files.
- Log in to your Google Tag Manager account and create a new container for your Magento store.
- Obtain your Google Tag Manager container ID.
- Log in to the Magento admin panel and navigate to Stores > Configuration > GTM Data Layer.
- Enter your Google Tag Manager container ID in the provided field.
- Configure the data layer variables and event triggers as needed.
- Save the configuration and clear the Magento cache.
- The module will automatically populate the data layer variables and trigger events based on your configuration.
- coming soon
Contributions are welcome! If you have any suggestions, improvements, or bug fixes, please submit a pull request.
The Magento 2 GTM Data Layer Module is open-source software licensed under the MIT license.
For any issues or questions, please open an issue on the GitHub repository.
This module is provided as-is without any warranty. Use it at your own risk.