A custom web pixel for Shopify that sends complete e-commerce tracking events directly to Google Analytics 4.
- Complete GA4 e-commerce event tracking (view_item, add_to_cart, purchase, etc.)
- SKU-based item IDs with Shopify ID fallback
- Dynamic product category mapping from collections
- Clean product names (removes variant suffixes)
- Discount and coupon tracking
- Debug mode for development
- Update the
CONFIGobject inindex.jswith your tracking IDs - Upload to Shopify Admin → Settings → Customer events → Custom pixels
- Test in preview mode with DEBUG_MODE enabled
const CONFIG = {
GOOGLE_TAG_ID: 'GT-XXXXXXX', // Your Google Tag Container ID
IDS: {
ga4: 'G-XXXXXXX',
},
CURRENCY: 'EUR',
DEBUG_MODE: false
};Made to help others facing the same Shopify GA4 tracking challenges.