The GA4 Tracking ATC plugin tracks WooCommerce add to cart events in Google Analytics 4 for all product and taxonomy types.
Features
- Complete GA4 Integration: Tracks add to cart events with proper GA4 ecommerce parameters
- Bundled Product Support: Tracks bundle products with individual child items in the
items[]
array - Multiple Product Types: Supports simple, variable, grouped, external, composite, and subscription products
- AJAX & Non-AJAX Support: Works with both AJAX and non-AJAX add to cart functionality
- HPOS Compatible: Full support for High-Performance Order Storage (HPOS)
- Debug Mode: Optional debug logging for troubleshooting
- Admin Settings: Easy configuration through WordPress admin panel
Installation
- Upload the plugin files to
/wp-content/plugins/ga-tracking-atc/
directory - Activate the plugin through the ‘Plugins’ screen in WordPress
- Go to WooCommerce > GA4 Tracking ATC to configure your GA4 Measurement ID
Configuration
Required Settings
- GA4 Measurement ID: Enter your Google Analytics 4 Measurement ID (e.g., G-XXXXXXXXXX)
- Enable Debug Mode: Enable detailed logging for troubleshooting
Product Type Settings
The plugin allows you to enable or disable tracking for specific product types:
- Simple Products: Track basic add to cart events for simple products
- Variable Products: Track add to cart events for variable products with selected variations
- Grouped Products: Track individual products added from grouped products
- External Products: Track clicks on external products (redirects to external sites)
- Bundle Products: Track bundle products with individual bundle items in the items array
- Composite Products: Track composite products with individual components
- Subscription Products: Track subscription products with subscription-specific data
Note: All product types are enabled by default. The settings page is located under WooCommerce > GA4 Tracking ATC in the WordPress admin menu.

Product Taxonomy Settings
The plugin allows you to enable or disable tracking for products in specific taxonomies:
- Product Categories: Track products that belong to product categories
- Product Tags: Track products that have product tags
- Product Brands (WooCommerce Brands): Track products that have brands (WooCommerce Brands plugin)
Note: All taxonomies are enabled by default. Only products that belong to enabled taxonomies will be tracked. If no taxonomies are enabled, all products will be tracked. The plugin will show availability status for brand taxonomies (✓ available or ⚠not available).
GA4 Setup
Make sure you have the Google Analytics 4 tracking code installed on your site. The plugin will automatically send events to GA4 using the gtag
function.
Supported Product Types
Simple Products
- Tracks basic add to cart events
- Includes product name, category, brand, price, and quantity
Variable Products
- Tracks selected variation
- Includes variation attributes in the event data
- Supports both AJAX and non-AJAX add to cart
Bundled Products (WooCommerce Product Bundles)
- Tracks the main bundle product
- Tracks each bundled item individually in the
items[]
array - Includes bundle relationship data
- Supports dynamic quantity changes
Grouped Products
- Tracks individual products that were added from the group
- Maintains group relationship information
External Products
- Tracks external product clicks
- Includes external URL information
Composite Products (WooCommerce Composite Products)
- Tracks main composite product
- Tracks individual components
- Maintains component relationships
Subscription Products (WooCommerce Subscriptions)
- Tracks subscription-specific data
- Includes subscription period and interval information
Debug Mode
When debug mode is enabled, the plugin will log detailed information to the WordPress debug log:
[2025-01-13 10:30:15] GA4 Tracking ATC: Non-AJAX add to cart triggered for product ID: 123
[2025-01-13 10:30:15] GA4 Tracking ATC: Bundle tracking data prepared: {"event":"add_to_cart",...}
Troubleshooting
Common Issues
Events not appearing in GA4:
- Verify your GA4 Measurement ID is correct
- Check that the GA4 tracking code is installed
- Enable debug mode to see if events are being sent
Bundle items not tracking:
- Ensure WooCommerce Product Bundles plugin is active
- Check that bundle tracking is enabled in settings
- Verify bundle products are properly configured
AJAX add to cart not working:
- Check browser console for JavaScript errors
- Verify AJAX endpoints are accessible
- Enable debug mode to see AJAX requests
Debug Information
The plugin provides comprehensive debug logging when debug mode is enabled. Check your WordPress debug log for detailed information about:
- Add to cart events
- Product data preparation
- GA4 event sending
- AJAX requests and responses
Compatibility
- WooCommerce Product Bundles: Full support for bundle tracking
- WooCommerce Composite Products: Full support for composite tracking
- WooCommerce Subscriptions: Full support for subscription tracking
- WooCommerce Brands: Automatic brand detection
Support
For support and feature requests, please contact the plugin developer brad@wpsites.net
Reviews
There are no reviews yet.