tlamedia/gtm-kit

Development files for the GTM Kit

Maintainers

Package info

github.com/tlamedia/gtm-kit

Homepage

Type:wordpress-plugin

pkg:composer/tlamedia/gtm-kit

Statistics

Installs: 2 337

Dependents: 0

Suggesters: 0

Stars: 17

Open Issues: 3


README

WordPress Plugin Version License: GPL v3

Google Tag Manager and GA4 integration for WordPress, focused on flexibility and page speed.

GTM Kit places the Google Tag Manager container on your site, no code required, and pushes structured data to the dataLayer for use with GA4, Facebook, and any other GTM tag. It ships e-commerce tracking for WooCommerce and Easy Digital Downloads, plus form tracking for Contact Form 7, and gives developers hooks to customise everything.

Highlights

  • Zero-code container injection with optional delayed loading until the browser is idle, for page-speed-sensitive sites.
  • Server-side GTM (sGTM) support, including custom domains, custom loaders, and full Stape compatibility.
  • GA4 e-commerce tracking for WooCommerce and Easy Digital Downloads (view_item, add_to_cart, begin_checkout, purchase, and more).
  • Per-page exclusion of the container and data layer via glob or regex URL patterns.
  • Configurable post data in the data layer: post type, page type, categories, tags, and more.
  • Developer-friendly: actions and filters to customise the data layer and container output.

Add-on

GTM Kit is the free core. GTM Kit Woo extends it with advanced WooCommerce tracking and is available on the WooCommerce marketplace. It requires this plugin.

Installation

For end users, install from the WordPress plugin directory or search for "GTM Kit" under Plugins → Add New in wp-admin.

To run from source:

composer install
npm ci

Development

This repo holds the gtm-kit core plugin. Classes in src/ use PSR-4 autoloading via Composer; the entry point is gtm-kit.php.

Quality checks

Run these before committing PHP changes:

composer phpstan   # Static analysis (level 6, bleeding edge)
composer phpcs     # Coding standards (WordPress-Extra + Docs)
composer phpcbf    # Auto-fix coding-standard issues

Tests

Three harnesses ship here: PHPUnit unit (no WordPress boot), PHPUnit integration (boots WordPress against a real DB), and Vitest for the JavaScript modules. See tests/README.md for prerequisites, one-command setup, and how to run each suite.

Contributing

Found a bug or have a feature idea? Open an issue. Pull requests are welcome.

License

GPLv3 or later. See LICENSE.