Skip to content
GEOFIX NYA WEBBSHOP ÄR HÄR - klicka här för att få information om hur du som redan är Geofix kund kommer åt ditt webbkonto
GEOFIX NYA WEBBSHOP ÄR HÄR - klicka här för att få information om hur du som redan är Geofix kund kommer åt ditt webbkonto

HP SitePrint

Groundbreaking layout efficiency - Easily get digital layouts out on the floor.
HP's printing expertise combined with their robotics technology means that projects can be completed faster and more smoothly without errors.

Click here to see what our customers think: Customer Stories : Geofix E-commerce Site

Filters

HP SitePrint

New HP SitePrint Value Pack 3.0: Improve construction productivity and autonomy Efficiency is paramount for the construction industry, a...

View full details
*/ (function () { window.dataLayer = window.dataLayer || []; const CONFIG = { CURRENCY: "SEK", // Lägg gärna till/justera selektorer om ditt tema använder andra element CHECKOUT_BUTTON_SELECTORS: [ 'button[name="checkout"]', 'input[name="checkout"]', 'form[action*="/checkout"] [type="submit"]', 'a[href*="/checkout"]' ] }; function fetchCart() { return fetch('/cart.js', { credentials: 'same-origin' }) .then(r => r.json()) .catch(() => null); } function mapItems(cart) { if (!cart || !Array.isArray(cart.items)) return []; return cart.items.map((it, idx) => ({ item_id: String(it.variant_id || it.id || it.sku || ''), item_name: it.product_title || it.title || '', item_brand: 'Geofix AB', item_variant: it.variant_title || '', price: (typeof it.final_price === 'number' ? it.final_price : it.price || 0) / 100, quantity: it.quantity || 1, index: idx + 1 })); } function totalValue(items) { return items.reduce((s, i) => s + (Number(i.price) || 0) * (Number(i.quantity) || 0), 0); } function isCheckoutClick(target) { if (!target) return false; // träff på definierade selektorer for (const sel of CONFIG.CHECKOUT_BUTTON_SELECTORS) { if (target.closest(sel)) return true; } // fallback: formulär som postar till /checkout const form = target.closest('form'); if (form && /\/checkout/i.test(form.action || '')) return true; return false; } // Lyssna brett i capture-fasen så vi hinner hämta vagnen innan redirect document.addEventListener('click', function (e) { const el = e.target; if (!isCheckoutClick(el)) return; // Hämta /cart.js och pusha begin_checkout snabbt innan sidan lämnas fetchCart().then(cart => { const items = mapItems(cart); const value = totalValue(items); window.dataLayer.push({ event: 'begin_checkout', ecommerce: { currency: CONFIG.CURRENCY, value: value, items: items } }); }); // Ingen preventDefault – låt redirect ske normalt }, true); // Extra säkerhet: lyssna även på submit (t.ex. enter-tryck i formulär) document.addEventListener('submit', function (e) { const form = e.target; if (!form) return; if (!/\/checkout/i.test(form.action || '')) return; fetchCart().then(cart => { const items = mapItems(cart); const value = totalValue(items); window.dataLayer.push({ event: 'begin_checkout', ecommerce: { currency: CONFIG.CURRENCY, value: value, items: items } }); }); }, true); })();