(function () { 'use strict'; const LISTENER_NAME = 'ga4EcommerceEventsListener'; const REGISTRATION_FLAG = '__ga4EcommerceEventsListenerRegistered'; const DEBUG = true; // Maps Wix's analytics event names to the standard GA4 ecommerce event names. const EVENT_MAP = { ViewContent: 'view_item', AddToCart: 'add_to_cart', InitiateCheckout: 'begin_checkout' }; if (window[REGISTRATION_FLAG]) { return; } window[REGISTRATION_FLAG] = true; window.dataLayer = window.dataLayer || []; function log() { if (DEBUG && window.console) { console.log.apply(console, arguments); } } function warn() { if (window.console) { console.warn.apply(console, arguments); } } function toNumber(value) { if (typeof value === 'number') { return Number.isFinite(value) ? value : 0; } const number = Number( String(value || '').replace(/[^0-9.-]/g, '') ); return Number.isFinite(number) ? number : 0; } function createItems(contents) { if (!Array.isArray(contents) || !contents.length) { return []; } return contents.map(function (item, index) { const itemId = item.sku || item.id || item.Id || 'wix-item-' + (index + 1); const itemName = item.name || item.itemName || itemId; const ga4Item = { item_id: String(itemId), item_name: String(itemName), price: toNumber(item.price), quantity: Math.max( 1, toNumber(item.quantity) || 1 ) }; if (item.category) { ga4Item.item_category = String(item.category); } if (item.brand) { ga4Item.item_brand = String(item.brand); } if (item.variant) { ga4Item.item_variant = String(item.variant); } return ga4Item; }); } function sendEcommerceEvent(gaEventName, payload) { payload = payload || {}; const items = createItems(payload.contents); if (!items.length) { warn( '[Wix GA4] ' + gaEventName + ' fired with no items, skipping.', payload ); return; } const currency = String( payload.currency || (payload.contents[0] && payload.contents[0].currency) || '' ).trim().toUpperCase(); const fallbackValue = items.reduce(function (sum, item) { return sum + item.price * item.quantity; }, 0); const value = Number( (toNumber(payload.value || payload.revenue) || fallbackValue).toFixed(2) ); // Clear the previous ecommerce object first so GTM/GA4 don't merge // items from a prior event into this one. window.dataLayer.push({ ecommerce: null }); window.dataLayer.push({ event: gaEventName, ecommerce: { currency: currency || undefined, value: value, items: items } }); log('[Wix GA4] ' + gaEventName + ' sent:', payload); } function registerWixListener() { if ( !window.wixDevelopersAnalytics || typeof window.wixDevelopersAnalytics.register !== 'function' ) { warn('[Wix GA4] Wix analytics API unavailable.'); return; } if (window[REGISTRATION_FLAG + '_listener']) { return; } window[REGISTRATION_FLAG + '_listener'] = true; window.wixDevelopersAnalytics.register( LISTENER_NAME, function (eventName, payload) { const gaEventName = EVENT_MAP[eventName]; if (gaEventName) { log('[Wix GA4] Wix ' + eventName + ' event received:', payload); sendEcommerceEvent(gaEventName, payload); } } ); log('[Wix GA4] Ecommerce events listener registered.'); } if (window.wixDevelopersAnalytics) { registerWixListener(); } else { window.addEventListener( 'wixDevelopersAnalyticsReady', registerWixListener, { once: true } ); } })();
top of page

(061) 439 949 | bmpartsandtools@gmail.com | Unit 3 Crossagalla Industrial Estate, Ballysimon, Limerick, V94E6C0

bg2.jpg

BM Parts & Tools

For affordable high-quality security locks, spare parts and tools contact BM Parts & Tools

8mm & 10mm Magnetic Impact Hex Drive ( Shock Proof / Heat Treated )

€4.95
Price incl. VAT (23%) €0.93
Size
In stock
Save this product for later
Share this product with your friends
8mm & 10mm Magnetic Impact Hex Drive ( Shock Proof / Heat Treated )
bottom of page