=== Lean GA4 Tracker === Contributors: maidulcu Tags: google analytics, GA4, tracking, lightweight Requires at least: 6.2 Tested up to: 6.7 Stable tag: 1.0.7 Requires PHP: 8.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Lightweight GA4 tracker with GTM support, custom events, privacy-friendly setup, and tabbed settings. Manual GA4 API token support included. == Description == A lightweight, developer-friendly plugin to integrate Google Analytics 4 (GA4) tracking with WordPress. Designed for performance and simplicity, Lean GA4 Tracker lets you implement advanced GA4 tracking without the bloat of larger analytics plugins. Support for manual GA4 API access tokens, tab-based settings UI, and optional Google Tag Manager (GTM) container injection. == Key Features: == - Easy integration with GA4 using your Measurement ID - Lightweight, performance-first architecture with no bloat - Manual GA4 API access using user-supplied access tokens and property IDs - Optional Google Tag Manager (GTM) container injection via settings - Custom GA4 Event Tracking via JSON input - Tabbed settings UI for clean configuration management - Debug Mode for inspecting events in the console (admin only) - Error notices for invalid JSON in Custom Events field - Site-level and Multisite Network-level settings with optional enforcement - Configurable script loading (default, async, or defer) - Clean, class-based architecture with Composer and PSR-4 autoloading - Developer-friendly and extensible for custom implementations - Privacy-aware: Optional integration with Consent Mode and cookie banner plugins (e.g., Complianz, CookieYes) Whether you’re a developer building custom themes or a site owner who wants full control over analytics, Lean GA4 Tracker delivers exactly what you need — nothing more, nothing less. == Installation == 1. Upload the plugin files to /wp-content/plugins/lean-ga4-tracker 2. Activate the plugin from your WordPress dashboard 3. Go to Settings → Lean GA4 Tracker to configure == Frequently Asked Questions == = Can I track custom events without writing JavaScript? = Yes. You can enter a JSON array of custom GA4 events in the settings panel, and they will be dispatched automatically. = How does the plugin support Consent Mode? = It initializes GA4 with `ad_storage: denied` and `analytics_storage: granted` by default. You can modify or extend this via hooks. = Does this plugin support multisite networks? = Yes. Network admins can enforce a GA4 configuration across all sites or allow individual site overrides. = Where is the GA4 script loaded? = The script can be loaded using standard, `async`, or `defer` attributes — configurable from the admin settings. = Is the plugin suitable for developers? = Absolutely. The plugin is built using PSR-4 autoloading, Composer, and separates concerns with namespaced classes. It’s ready for extension or integration in your theme or stack. = Does the plugin support cookie consent banners? = While Lean GA4 Tracker does not include a built-in banner, it supports integration with popular cookie banner plugins such as Complianz and CookieYes. These can be configured to trigger GA4 tracking only after user consent. = Can I use Google Consent Mode with this plugin? = Yes. If enabled in the Privacy tab, the plugin will initialize GA4 with Consent Mode defaults. You can manually trigger `gtag('consent', 'update', ...)` after consent is granted. = 1.0.7 = * Improved Multisite Compatibility for Custom Events * Added sample GA4 event JSON and live validation to both site-level and network-level settings * Enhanced admin UI guidance for defining custom events across installations == Changelog == = 1.0.6 = * Added Privacy & Consent settings tab with support for Google Consent Mode * Added notice recommending cookie banner plugins for frontend consent control * Improved ConsentManager handling and script modularity = 1.0.5 = * Introduced tab-based settings UI with General, Authentication, Events, and Debug sections * Added manual GA4 access token and property ID input for non-OAuth usage * Added GTM container injection option with `
` and `