kalicr/module-gtm (1.1.0)

Published 2026-07-20 21:41:03 +00:00 by kalicr-packages

Installation

{
	"repositories": [{
			"type": "composer",
			"url": ""
		}
	]
}
composer require kalicr/module-gtm:1.1.0

About this package

GA4 GTM ecommerce events for Magento 2 — injects GTM snippet and pushes GA4 dataLayer events (view_item, add_to_cart, begin_checkout, purchase, etc.).

KaliCR Logo

Module Kalicr_Gtm

Magento 2 module that injects the Google Tag Manager (GTM) snippet and pushes GA4-compatible dataLayer ecommerce events: view_item, view_item_list, select_item, add_to_cart, remove_from_cart, add_to_wishlist, view_cart, begin_checkout, add_shipping_info, add_payment_info, and purchase.

This module is developed by Kal-i CR Development Team.

Features

  • GTM snippet injection: inserts the GTM <script> in <head> and the <noscript> fallback after <body> on every page.
  • Configurable Container ID: the GTM Container ID is set from the Magento admin panel — no code changes required per project.
  • Enabled/Disabled toggle: the snippet is only rendered when the module is enabled from configuration.
  • Dynamic currency: reads the store's active currency via StoreManagerInterface — no hardcoded values.
  • GA4 dataLayer events: pushes standard ecommerce events using RequireJS modules and native Magento JS mixins for checkout steps.
  • CSP nonce support: the GTM script tag respects the Magento CSP nonce when present.

Admin Configuration

Stores → Configuration → Kal-í CR Extensiones → Google Tag Manager

Field Description
Enable GTM Activates/deactivates the snippet injection
Container ID GTM Container ID (e.g. GTM-XXXXXXXX)

Configuration is scoped to store view level.

Installation

Via Composer

composer require kalicr/module-gtm
bin/magento module:enable Kalicr_Gtm
bin/magento setup:upgrade
bin/magento cache:clean

Manual installation

  1. Copy the module into app/code/Kalicr/Gtm.
  2. Run:
bin/magento module:enable Kalicr_Gtm
bin/magento setup:upgrade
bin/magento cache:clean

Dependencies

  • PHP: ^8.1 || ^8.2 || ^8.3
  • Composer packages:
    • magento/framework
    • magento/module-backend
    • magento/module-catalog
    • magento/module-checkout
    • magento/module-config
    • magento/module-customer
    • magento/module-sales
    • magento/module-store

Compatibility

  • Adobe Commerce / Magento Open Source: 2.4.6, 2.4.7, 2.4.8
  • PHP: ^8.1 || ^8.2 || ^8.3

Technical notes

  • GTM block: Kalicr\Gtm\Block\Gtm — reads config, renders head/body snippets
  • Init block: Kalicr\Gtm\Block\Init — exposes store currency to JS
  • Products block: Kalicr\Gtm\Block\Products — resolves current product and category path
  • Purchase block: Kalicr\Gtm\Block\Purchase — resolves last order for purchase event
  • JS entry point: Kalicr_Gtm/js/ga4
  • RequireJS mixins: shipping-info, payment-info, remove-item
  • Config paths:
    • kalicr_gtm/general/enabled
    • kalicr_gtm/general/container_id

Changelog

Release notes are maintained in CHANGELOG.md.

Support

If you need help with this module, contact Kal-i CR Development Team:

  • Email: contacto@kalicr.com

License

This package is distributed under the proprietary KaliCR commercial license. See LICENSE.md.

Release workflow

This repository publishes the package through Forgejo Composer Registry.

Dependencies

Dependencies

ID Version
magento/framework >=103.0
magento/module-backend >=102.0
magento/module-catalog >=104.0
magento/module-checkout >=100.4
magento/module-config >=101.0
magento/module-customer >=103.0
magento/module-sales >=102.0
magento/module-store >=101.1
php ^8.1 || ^8.2 || ^8.3
Details
Composer
2026-07-20 21:41:03 +00:00
4
Kal-i CR Development Team
proprietary
25 KiB
Assets (1)
Versions (2) View all
1.1.0 2026-07-20
1.0.0 2026-07-15