Frontend Engineering• Published: September 2, 2026

SVG Iconography & Centralized Vector Systems: Scalable Resolution-Independent UI

Architectural Analysis: Highclasswebdesign Engineering Directorate • WCAG & CWV Standards Audited

Icon fonts introduce HTTP request overhead and unpredictable rendering glitches. For bespoke luxury websites, an icon that renders as an empty square or displays blurry glyph antialiasing destroys brand credibility. Centralized SVG vector systems eliminate network dependencies, guarantee resolution independence on 5K Retina displays, and seamlessly integrate into modern component architectures.

Modern SVG Architecture Comparison

Evaluating vector delivery mechanisms reveals the profound architectural advantages of centralized React SVG component libraries:

Vector Approach HTTP Overhead Color Customization Accessibility Support
Legacy Icon Fonts Blocking .woff2 font download CSS font color only (No multi-color support) Poor screen reader comprehension
Individual <img src=".svg"> Multiple network requests Zero CSS color fill manipulation Basic alt attribute only
Inline React SVG Components Zero additional HTTP requests Full CSS variable manipulation (currentColor) Full ARIA attributes and title tags

Centralized React SVG Component Architecture

In the highclasswebdesign.com design system, all iconography is centralized in a dedicated vector module (Icons.tsx). Every icon exposes standard TypeScript props for dimension, color, and accessibility:

// components/Icons.tsx - Production Scalable Vector Library
import React from 'react';

export interface IconProps extends React.SVGProps<SVGSVGElement> {
  size?: number;
  color?: string;
  title?: string;
}

export const GemstoneIcon: React.FC<IconProps> = ({
  size = 24,
  color = 'currentColor',
  title,
  className = '',
  ...props
}) => (
  <svg
    width={size}
    height={size}
    viewBox="0 0 24 24"
    fill="none"
    stroke={color}
    strokeWidth="1.5"
    strokeLinecap="round"
    strokeLinejoin="round"
    aria-hidden={!title}
    role={title ? 'img' : 'presentation'}
    className={"luxury-icon " + className}
    {...props}
  >
    {title && <title>{title}</title>}
    <polygon points="6 3 18 3 22 9 12 22 2 9 6 3" />
    <line x1="12" y1="22" x2="12" y2="9" />
    <line x1="2" y1="9" x2="22" y2="9" />
    <line x1="6" y1="3" x2="10" y2="9" />
    <line x1="18" y1="3" x2="14" y2="9" />
  </svg>
);

The Explicit Dimension Rule & Zero Cumulative Layout Shift

A severe anti-pattern in modern web development is omitting numeric dimensions on SVG tags and relying on CSS utility classes like className="w-6 h-6". If the external stylesheet fails to load or experiences network latency, unconstrained SVG elements expand to 100% of the viewport width, instantly blowing up the page layout and causing catastrophic CLS scores.

All SVG icon components across our portfolio enforce explicit numeric width={24} height={24} attributes directly on the DOM element, ensuring that layout geometry is locked prior to CSS parsing.

Automated SVG Optimization Pipelines with SVGO

Vector graphics exported directly from design tools like Figma or Adobe Illustrator contain substantial unnecessary overhead: proprietary XML metadata, editing history comments, unoptimized decimal precision, and redundant nested grouping tags. This non-visual data can bloat an icon's file footprint by over 400%.

Enterprise frontend workflows integrate an automated SVGO optimization pipeline during build time. The optimizer strips extraneous metadata, collapses unnecessary transform matrices, and rounds floating-point coordinate precision to two decimal places. Crucially, it converts hardcoded fill and stroke hex colors into currentColor, enabling the vector iconography to seamlessly inherit typography colors and respond dynamically to hover, active, and focus CSS states.

Accessible Vector Semantics: Decorative vs. Informative Icons

Assistive technology users rely on accurate vector semantics. When an SVG is rendered without explicit ARIA labeling, screen readers frequently announce meaningless raw XML tag soup or skip the element entirely.

Bespoke UI architectures categorize every icon as either decorative or informative. Decorative icons (such as aesthetic gemstone flourishes accompanying heading text) must include aria-hidden="true" and role="presentation" to prevent auditory distraction. Conversely, informative icons (such as standalone cart triggers, navigation chevrons, or search magnifying glasses) require role="img", a descriptive inner <title> element, and explicit aria-label bindings to ensure complete screen reader accessibility.

Frequently Asked Questions (FAQ)

Why are inline SVG icon components superior to legacy icon fonts (FontAwesome, Glyphicons)?

Icon fonts suffer from major architectural flaws: they block initial text rendering while downloading custom font files, cause flashing unstyled icons (FOIT/FOUT), render with inconsistent subpixel antialiasing across operating systems, cannot support multi-color paths, and fail screen reader accessibility. Inline SVG components render instantly with zero network delay and crisp vector precision.

How does currentColor simplify icon color theming in multi-brand systems?

By declaring fill="currentColor" or stroke="currentColor" on internal SVG path elements, the icon automatically inherits whatever text color is applied to its parent HTML container. When changing text color from slate to metallic gold during a button hover state, the icon transitions synchronously without requiring separate SVG stylesheets.

Why must SVG icon components declare explicit numeric width and height attributes?

Relying exclusively on CSS utility classes (like class="w-6 h-6") can cause visual layout shift if CSS execution is delayed or if the component is rendered in an environment without Tailwind. Declaring explicit width={24} height={24} guarantees that the SVG reserves its bounding box immediately, maintaining zero CLS.

How do you make SVG icons accessible to assistive technology and screen readers?

Decorative icons (icons paired with visible text labels) must declare aria-hidden="true" and focusable="false" so screen readers ignore them. Standalone icons (such as an unlabelled shopping bag button) must declare role="img" and include a child element with descriptive text, paired with aria-label on the interactive button wrapper.</p> </div> <div class="faq-item" style="background: #111114; border: 1px solid rgba(212, 175, 55, 0.2); border-radius: 8px; margin-bottom: 1rem; padding: 1.25rem;"> <h3 style="color: #d4af37; font-size: 1.1rem; margin-top: 0; margin-bottom: 0.5rem; font-family: var(--font-serif);">How does SVGO automated asset optimization reduce vector payload size?</h3> <p style="color: #cbd5e1; line-height: 1.7; margin-bottom: 0;">Raw SVG files exported from design software like Figma or Illustrator contain bloated metadata: editor comments, empty groups, hidden clip-paths, and over-precise floating point coordinates. Processing icons through SVGO strips redundant metadata and rounds path coordinates, slashing vector file weights by 50–70%.</p> </div> </div> <div class="cta-banner" style="background: linear-gradient(135deg, #111114 0%, #18181c 100%); border: 1px solid #d4af37; border-radius: 8px; padding: 2rem; margin-top: 3rem; text-align: center;"> <h3 style="color: #d4af37; font-size: 1.4rem; margin-top: 0; font-family: var(--font-serif);">Upgrade Your Platform to Crisp Vector Iconography</h3> <p style="color: #e2e8f0; max-width: 700px; margin: 0 auto 1.5rem auto; line-height: 1.6;"> Ready to elevate your brand with a bespoke digital flagship or audit your platform for sub-second Core Web Vitals? Consult with High Class Web Design. </p> <a href="https://highclasswebdesign.com/contact" style="display: inline-block; background: #d4af37; color: #070708; font-weight: 700; padding: 0.75rem 1.75rem; border-radius: 6px; text-decoration: none; transition: background 0.2s; letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.85rem;"> Consult with Our Architects </a> </div></div> <div style="margin-top:40px;padding:24px;background:#070708;border:1px solid rgba(212, 175, 55, 0.3);border-radius:8px;display:flex;gap:20px;align-items:flex-start"><div style="width:48px;height:48px;border-radius:50%;background:rgba(212, 175, 55, 0.15);display:flex;align-items:center;justify-content:center;font-size:24px;flex-shrink:0;color:#d4af37">✧</div> <div><h4 style="margin:0 0 6px 0;font-size:16px;color:#ffffff;font-weight:600;font-family:var(--font-serif)">Authored by the Highclasswebdesign Engineering Directorate</h4> <p style="margin:0;font-size:13px;color:#a0a0a5;line-height:1.6">Our design architects specialize in luxury web platform engineering, headless CMS content delivery pipelines, fluid CSS typography, and sub-second Core Web Vitals optimization for enterprise brands.</p></div></div></article> <aside id="sidebar" class="site-sidebar flex flex-col gap-6 " role="complementary"><div class="widget posts-widget" id="recent-posts-3"><h2 class="sidebartitle">Recent Insights</h2> <ul><li><a href="/luxury-web-design-architecture-bespoke-digital-flagships" title="Luxury Web Design Architecture: Crafting Bespoke High-Converting Digital Flagships">Luxury Web Design Architecture: Crafting Bespoke High-Converting Digital Flagships</a></li><li><a href="/headless-cms-architecture-high-traffic-enterprise-platforms" title="Headless CMS Architecture for High-Traffic Enterprise Brand Platforms">Headless CMS Architecture for High-Traffic Enterprise Brand Platforms</a></li><li><a href="/core-web-vitals-luxury-brands-sub-second-lcp" title="Core Web Vitals for Luxury Brands: Achieving Sub-Second Largest Contentful Paint (LCP)">Core Web Vitals for Luxury Brands: Achieving Sub-Second Largest Contentful Paint (LCP)</a></li><li><a href="/fluid-typography-css-math-functions-viewport-scalability" title="Fluid Typography & CSS Math Functions: Engineering Perfect Viewport Scalability">Fluid Typography & CSS Math Functions: Engineering Perfect Viewport Scalability</a></li><li><a href="/wcag-aaa-accessibility-luxury-design-compliance" title="WCAG 2.1 AAA Accessibility in Luxury Design: Harmonizing Elegance with Compliance">WCAG 2.1 AAA Accessibility in Luxury Design: Harmonizing Elegance with Compliance</a></li><li><a href="/css-subgrid-container-queries-resilient-design-systems" title="CSS Subgrid & Container Queries: Building Resilient Component Design Systems">CSS Subgrid & Container Queries: Building Resilient Component Design Systems</a></li><li><a href="/micro-interactions-motion-design-cubic-bezier-physics" title="Micro-Interactions & Motion Design: Enhancing Perceived Performance with Cubic-Bezier Physics">Micro-Interactions & Motion Design: Enhancing Perceived Performance with Cubic-Bezier Physics</a></li><li><a href="/design-system-tokenization-multi-brand-architecture" title="Design System Tokenization: Structuring Multi-Brand Design Architecture">Design System Tokenization: Structuring Multi-Brand Design Architecture</a></li><li><a href="/high-converting-luxury-landing-pages-cro-principles" title="High-Converting Luxury Landing Pages: Conversion Rate Optimization (CRO) Principles">High-Converting Luxury Landing Pages: Conversion Rate Optimization (CRO) Principles</a></li><li><a href="/nextjs-react-server-components-digital-agencies" title="Next.js & React Server Components for Modern Digital Agencies">Next.js & React Server Components for Modern Digital Agencies</a></li></ul></div></aside></div></div></main> <footer class="luxury-footer hcwd-footer" style="margin-top:80px;border-top:1px solid rgba(212, 175, 55, 0.2);padding:56px 0 32px;color:#a0a0a5;font-size:13px;background:#070708"><div class="footer-container" style="max-width:1200px;margin:0 auto;padding:0 20px"><div class="footer-grid" style="display:grid;grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));gap:36px;margin-bottom:40px"><div class="footer-col about-col"><div style="display:flex;align-items:center;gap:10px;margin-bottom:14px"><span style="font-size:20px;color:#d4af37">✧</span><span style="font-size:17px;font-weight:600;color:#ffffff;font-family:var(--font-serif)">Highclasswebdesign Inc.</span></div> <p style="line-height:1.6;margin-bottom:14px;color:#a0a0a5">Designing bespoke, high-converting digital architectures, headless web platforms, and luxury brand interfaces.</p> <p style="font-size:12px;color:#94a3b8">Direct Inquiries: <a href="mailto:robert@webdesigner.la" style="color:#d4af37">robert@webdesigner.la</a></p></div> <div class="footer-col links-col"><h4 style="color:#ffffff;font-size:14px;font-weight:600;margin-bottom:14px;text-transform:uppercase;letter-spacing:0.08em;font-family:var(--font-serif)">Design Insights</h4> <ul style="list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:8px"><li><a href="/luxury-web-design-architecture-bespoke-digital-flagships" style="color:#a0a0a5;text-decoration:none">Digital Flagship Architecture</a></li><li><a href="/headless-cms-architecture-high-traffic-enterprise-platforms" style="color:#a0a0a5;text-decoration:none">Headless CMS Platforms</a></li><li><a href="/core-web-vitals-luxury-brands-sub-second-lcp" style="color:#a0a0a5;text-decoration:none">Sub-Second LCP Performance</a></li><li><a href="/fluid-typography-css-math-functions-viewport-scalability" style="color:#a0a0a5;text-decoration:none">Fluid CSS Typography</a></li><li><a href="/articles" style="color:#d4af37;font-weight:600;text-decoration:none">View All Publications →</a></li></ul></div> <div class="footer-col links-col"><h4 style="color:#ffffff;font-size:14px;font-weight:600;margin-bottom:14px;text-transform:uppercase;letter-spacing:0.08em;font-family:var(--font-serif)">Engineering Standards</h4> <ul style="list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:8px"><li><a href="/wcag-aaa-accessibility-luxury-design-compliance" style="color:#a0a0a5;text-decoration:none">WCAG 2.1 AAA Accessibility</a></li><li><a href="/css-subgrid-container-queries-resilient-design-systems" style="color:#a0a0a5;text-decoration:none">CSS Subgrid & Container Queries</a></li><li><a href="/micro-interactions-motion-design-cubic-bezier-physics" style="color:#a0a0a5;text-decoration:none">Micro-Interactions & Physics</a></li><li><a href="/design-system-tokenization-multi-brand-architecture" style="color:#a0a0a5;text-decoration:none">Design System Tokenization</a></li><li><a href="/nextjs-react-server-components-digital-agencies" style="color:#a0a0a5;text-decoration:none">React Server Components (RSC)</a></li></ul></div> <div class="footer-col contact-col"><h4 style="color:#ffffff;font-size:14px;font-weight:600;margin-bottom:14px;text-transform:uppercase;letter-spacing:0.08em;font-family:var(--font-serif)">Agency & Legal</h4> <ul style="list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:8px"><li><a href="/about" style="color:#a0a0a5;text-decoration:none">About Our Agency</a></li><li><a href="/services" style="color:#a0a0a5;text-decoration:none">Bespoke Services</a></li><li><a href="/privacy" style="color:#a0a0a5;text-decoration:none">Privacy Policy</a></li><li><a href="/terms" style="color:#a0a0a5;text-decoration:none">Terms of Service</a></li><li><a href="/contact" style="color:#a0a0a5;text-decoration:none">Schedule Consultation</a></li></ul></div></div> <div class="footer-compliance-box" style="background:#111114;border:1px solid rgba(212, 175, 55, 0.15);border-radius:8px;padding:24px;margin-bottom:32px;font-size:12px;line-height:1.6;color:#a0a0a5"><p style="color:#ffffff;font-weight:600;margin-bottom:8px">Enterprise Design & Architectural Notices:</p> <p style="margin-bottom:8px">highclasswebdesign.com is an elite digital design engineering publication and bespoke consultancy. All design systems, code samples, and performance benchmarks are provided under professional software architecture standards.</p> <p><strong>Advertising & Cookie Disclosure:</strong> highclasswebdesign.com partners with third-party digital advertising providers including Google AdSense. Vendors use cookies, including Google DART cookies, to serve ads based on previous browsing sessions. Visitors may configure personalized cookie preferences via Google Ad Settings.</p></div> <div class="footer-bottom" style="display:flex;justify-content:space-between;align-items:center;border-top:1px solid rgba(255, 255, 255, 0.08);padding-top:24px;font-size:12px;color:#94a3b8"><p style="margin:0">© 2026 Highclasswebdesign Inc.. All rights reserved. · <a href="https://webdesigner.la" class="site-footer-link" rel="noopener">AI Agentic Developer</a></p> <div class="footer-bottom-links" style="display:flex;gap:16px"><a href="/privacy" style="color:#a0a0a5">Privacy Policy</a><a href="/terms" style="color:#a0a0a5">Terms of Service</a><a href="/contact" style="color:#a0a0a5">Contact Us</a></div></div></div></footer><script> (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "ya3pyo34oy"); </script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-GZM20M9BWQ'); gtag('set', { 'domain': window.location.hostname, 'site_name': window.location.hostname }); window.__PAYPAL_ENV__ = "production"; window.__cmsIsTestTransaction = function(payload) { if (window.__PAYPAL_ENV__ === 'sandbox' || window.__IS_HEADLESS_TEST__) return true; if (!payload) return false; if (payload.isTest === true || payload.is_test === true || payload.environment === 'sandbox') return true; var idStr = String(payload.orderId || payload.transaction_id || payload.transactionId || payload._id || ''); if (/^(TEST_|test_|ORD_TEST|ORD_SANDBOX|CAP-SANDBOX|WH-BURST|WH-TEST|SALE-|SIM_|FAKE_|MOCK_|SANDBOX_|CHK_|txn_)/i.test(idStr)) return true; var emailStr = String(payload.email || payload.customerEmail || payload.payerEmail || '').toLowerCase(); if (emailStr && (/@(example.com|test.com|sandbox.paypal.com|business.example.com|personal.example.com)$/.test(emailStr) || emailStr.indexOf('sb-') === 0)) return true; return false; }; // Known Catalog Dictionary for Accurate GA4 & Clarity Product Reporting window.__CMS_CATALOG = { 'hosting': { id: 'hosting-unlimited', name: 'Unlimited Web Hosting ($5/mo)', price: 5.00, category: 'Web Hosting Subscriptions', brand: 'WinWinHost' }, 'hosting-unlimited': { id: 'hosting-unlimited', name: 'Unlimited Web Hosting ($5/mo)', price: 5.00, category: 'Web Hosting Subscriptions', brand: 'WinWinHost' }, 'unlimited-web-hosting': { id: 'hosting-unlimited', name: 'Unlimited Web Hosting ($5/mo)', price: 5.00, category: 'Web Hosting Subscriptions', brand: 'WinWinHost' }, 'ai-agent': { id: 'ai-agent', name: 'In-Cloud Web Designer Agent ($10/mo)', price: 10.00, category: 'AI Webmaster Subscriptions', brand: 'WinWinHost' }, 'growth-bundle': { id: 'growth-bundle', name: 'All-in-One Growth Bundle ($15/mo)', price: 15.00, category: 'Managed Cloud Bundles', brand: 'WinWinHost' }, 'reseller': { id: 'reseller-hosting', name: 'Unlimited Reseller Web Hosting ($20/mo)', price: 20.00, category: 'Reseller Hosting Subscriptions', brand: 'WinWinHost' }, 'reseller-hosting': { id: 'reseller-hosting', name: 'Unlimited Reseller Web Hosting ($20/mo)', price: 20.00, category: 'Reseller Hosting Subscriptions', brand: 'WinWinHost' }, '30min': { id: 'strategy-30', name: '30-Minute Full-Stack Consultation', price: 75.00, category: 'Consultations', brand: 'WebDesigner.LA' }, '60min': { id: 'architecture-60', name: '60-Minute Architecture Session', price: 150.00, category: 'Consultations', brand: 'WebDesigner.LA' }, 'deepdive': { id: 'deepdive-120', name: '2-Hour Deep Dive & Code Review', price: 280.00, category: 'Consultations', brand: 'WebDesigner.LA' } }; // Global CMS Lead & Form Submission Tracker (GA4 + Microsoft Clarity) window.cmsTrackLead = function(type, data) { try { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction(data)) { return; } var domain = (data && data.domain) ? data.domain : window.location.hostname; var leadType = type || 'contact'; window.__cms_tracked_leads = window.__cms_tracked_leads || {}; if (window.__cms_tracked_leads[leadType]) { return; } window.__cms_tracked_leads[leadType] = true; var label = domain + ' - ' + leadType; var formName = (data && data.form_name) ? data.form_name : (domain + ' ' + leadType + ' form'); var trafficSource = (data && data.utm_source) ? (data.utm_source + ' / ' + (data.utm_medium || '(none)')) : (document.referrer ? document.referrer : '(direct)'); if (typeof gtag === 'function') { gtag('event', 'generate_lead', { event_category: 'Lead Generation', event_label: label, lead_type: leadType, method: leadType, domain: domain, form_id: (data && data.form_id) ? data.form_id : (leadType + '_form'), form_name: formName, traffic_source: trafficSource, page_location: window.location.href, page_title: document.title, page_referrer: document.referrer || '', value: (data && typeof data.value === 'number') ? data.value : 1.0, currency: 'USD' }); } if (typeof window !== 'undefined' && typeof window.clarity === 'function') { window.clarity("set", "lead_type", leadType); window.clarity("set", "lead_domain", domain); window.clarity("set", "lead_form", formName); if (trafficSource) { window.clarity("set", "traffic_source", trafficSource); } window.clarity("event", "generate_lead"); window.clarity("event", "lead_" + leadType); } } catch (e) { console.warn('[Lead Track Error]', e); } }; // Global CMS Outbound Affiliate & Call Redirect Tracker (GA4 + Clarity + First-Party Beacon) window.cmsTrackAffiliateClick = function(partnerName, outboundUrl, clickType, linkText, meta) { try { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction()) { return; } var domain = window.location.hostname; var sourcePath = window.location.pathname || '/'; var pName = partnerName || 'Affiliate Partner'; var cType = clickType || 'affiliate_redirect'; var outUrl = outboundUrl || ''; var lText = String(linkText || '').trim().slice(0, 140); var extra = (meta && typeof meta === 'object') ? meta : {}; var linkDomain = extra.linkDomain || ''; if (!linkDomain && outUrl) { try { var parsedOut = new URL(outUrl, window.location.origin); linkDomain = (parsedOut.hostname || '').toLowerCase().replace(/^www\./, ''); } catch (urlErr) { linkDomain = ''; } } var affNetwork = extra.affiliateNetwork || cType; var affCode = extra.affiliateCode || ''; // Deduplicate rapid duplicate dispatches for the exact same click target within 500ms var nowMs = Date.now(); var dedupeSig = cType + '|' + outUrl; if (window.__cmsLastAffClick && window.__cmsLastAffClick.sig === dedupeSig && (nowMs - window.__cmsLastAffClick.ts) < 500) { return; } window.__cmsLastAffClick = { sig: dedupeSig, ts: nowMs }; try { var analyticsIds = (typeof window.cmsGetAnalyticsIds === 'function') ? window.cmsGetAnalyticsIds() : (window.__CMS_ANALYTICS_IDS__ || {}); var beaconPayload = JSON.stringify({ sourceDomain: domain, sourceUrl: window.location.href, sourcePath: sourcePath, destinationUrl: outUrl, partnerName: pName, clickType: cType, linkText: lText, linkDomain: linkDomain, affiliateNetwork: affNetwork, affiliateCode: affCode, ga4MeasurementId: 'G-GZM20M9BWQ', ga4EventName: 'affiliate_click', ga4ClientId: analyticsIds.ga4_client_id || '', ga4SessionId: analyticsIds.ga4_session_id || '', clarityProjectId: 'ya3pyo34oy', clarityEventName: 'affiliate_click', clarityUserId: analyticsIds.clarity_user_id || '', claritySessionId: analyticsIds.clarity_session_id || '' }); if (typeof navigator !== 'undefined' && typeof navigator.sendBeacon === 'function') { var blob = new Blob([beaconPayload], { type: 'application/json' }); navigator.sendBeacon('/api/analytics/affiliate-click', blob); } else if (typeof window.fetch === 'function') { window.fetch('/api/analytics/affiliate-click', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: beaconPayload, keepalive: true }).catch(function() {}); } } catch (beaconErr) {} if (typeof gtag === 'function') { var gaEventParams = { event_category: 'affiliate', event_label: pName + (lText ? (' - ' + lText) : ''), partner_name: pName, affiliate_network: affNetwork, outbound_url: outUrl, link_url: outUrl, link_domain: linkDomain, link_text: lText, click_type: cType, domain: domain, source_path: sourcePath, page_location: window.location.href, page_title: document.title, page_referrer: document.referrer || '', transport_type: 'beacon' }; if (affCode) { gaEventParams.affiliate_code = affCode; } gtag('event', 'affiliate_click', gaEventParams); } if (typeof window !== 'undefined' && typeof window.clarity === 'function') { window.clarity("set", "affiliate_partner", pName); window.clarity("set", "affiliate_network", affNetwork); if (linkDomain) { window.clarity("set", "affiliate_domain", linkDomain); } window.clarity("event", "affiliate_click"); } } catch (e) { console.warn('[Affiliate Track Error]', e); } }; // Global CMS Checkout Initiation Tracker (GA4 + Microsoft Clarity) window.cmsTrackBeginCheckout = function(itemData) { try { if (itemData) { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction(itemData)) { if (window.console && console.info) { console.info('🛑 [CMS GA4 Suppressed] Ignored test/sandbox begin_checkout'); } return; } var price = typeof itemData.price === 'number' ? itemData.price : (parseFloat(itemData.price) || 0); var itemId = itemData.id || itemData.slug || 'custom_plan'; var itemName = itemData.name || 'Subscription Plan'; var itemCat = itemData.category || 'Subscriptions'; var itemBrand = itemData.brand || window.location.hostname; if (typeof gtag === 'function') { gtag('event', 'begin_checkout', { currency: 'USD', value: price, items: [{ item_id: itemId, item_name: itemName, item_category: itemCat, item_brand: itemBrand, price: price, quantity: 1 }] }); } if (typeof window !== 'undefined' && typeof window.clarity === 'function') { window.clarity("event", "begin_checkout"); window.clarity("set", "checkout_item", itemName); window.clarity("set", "checkout_value", String(price)); window.clarity("set", "checkout_category", itemCat); } if (typeof window.cmsSyncAnalyticsSession === 'function') { window.cmsSyncAnalyticsSession(itemData.orderId || itemData.order_id); } } } catch (e) { console.warn('[Begin Checkout Error]', e); } }; // Global CMS Cart Funnel Trackers (view_cart, add_to_cart, remove_from_cart) function emitCartFunnelEvent(eventName, gaParams, cartCount) { try { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction()) { return; } if (typeof gtag === 'function') { gtag('event', String(eventName), gaParams || {}); } if (typeof window !== 'undefined' && typeof window.clarity === 'function') { if (cartCount !== undefined && cartCount !== null) { window.clarity("set", "cart_items", String(cartCount)); } window.clarity("event", String(eventName)); } } catch (e) {} } window.cmsTrackViewCart = function(cartData) { var items = (cartData && Array.isArray(cartData.items)) ? cartData.items : []; var total = (cartData && typeof cartData.value === 'number') ? cartData.value : 0; if (!total && items.length) { for (var i = 0; i < items.length; i++) { total += (Number(items[i].price || 0) * Number(items[i].quantity || 1)); } } emitCartFunnelEvent('view_cart', { currency: (cartData && cartData.currency) || 'USD', value: Math.round(total * 100) / 100, items: items }, items.length || (cartData && cartData.cartCount)); }; window.cmsTrackAddToCart = function(itemData, cartCount) { var price = itemData ? (Number(itemData.price || 0) || 0) : 0; var qty = itemData ? (Number(itemData.quantity || 1) || 1) : 1; emitCartFunnelEvent('add_to_cart', { currency: (itemData && itemData.currency) || 'USD', value: Math.round(price * qty * 100) / 100, items: itemData ? [{ item_id: String(itemData.id || itemData.productID || 'item'), item_name: String(itemData.name || itemData.title || 'Product'), price: price, quantity: qty }] : [] }, cartCount); }; window.cmsTrackRemoveFromCart = function(itemData, cartCount) { var price = itemData ? (Number(itemData.price || 0) || 0) : 0; emitCartFunnelEvent('remove_from_cart', { currency: (itemData && itemData.currency) || 'USD', value: Math.round(price * 100) / 100, items: itemData ? [{ item_id: String(itemData.id || itemData.productID || 'item'), item_name: String(itemData.name || itemData.title || 'Product'), price: price, quantity: 1 }] : [] }, cartCount); }; // Global CMS Enhanced Ecommerce Purchase Tracker (GA4 + Microsoft Clarity) window.cmsTrackPurchase = function(order) { try { if (order) { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction(order)) { if (window.console && console.info) { console.info('🛑 [CMS GA4 Suppressed] Ignored test/sandbox purchase:', order.orderId || order.transaction_id); } return; } var txnId = order.orderId || order.transaction_id || order._id || ('TXN_' + Date.now()); // Prevent duplicate tracking on page refreshes var storageKey = '__cms_tracked_tx_' + txnId; if (typeof sessionStorage !== 'undefined') { if (sessionStorage.getItem(storageKey)) { return; } sessionStorage.setItem(storageKey, '1'); } // Standardize Items Array var items = []; var computedTotal = 0; if (Array.isArray(order.items) && order.items.length > 0) { items = order.items.map(function(item) { var itemPrice = typeof item.price === 'number' ? item.price : (parseFloat(item.price) || 0); var itemQty = typeof item.quantity === 'number' ? item.quantity : 1; computedTotal += (itemPrice * itemQty); return { item_id: String(item.productID || item.id || item.slug || 'item'), item_name: String(item.title || item.name || 'Product Subscription'), item_brand: String(item.brand || window.location.hostname), item_category: String(item.category || item.item_category || 'Subscriptions'), price: itemPrice, quantity: itemQty }; }); } var finalValue = typeof order.totalAmount === 'number' ? order.totalAmount : (typeof order.value === 'number' ? order.value : (parseFloat(order.totalAmount || order.value) || computedTotal)); // Dispatch GA4 Standard 'purchase' Event if (typeof gtag === 'function') { gtag('event', 'purchase', { transaction_id: txnId, value: finalValue, currency: order.currency || 'USD', tax: typeof order.tax === 'number' ? order.tax : 0.00, shipping: typeof order.shipping === 'number' ? order.shipping : 0.00, affiliation: order.affiliation || window.location.hostname, items: items }); } // Dispatch Microsoft Clarity Order Tags & Identification if (typeof window !== 'undefined' && typeof window.clarity === 'function') { window.clarity("set", "order_id", String(txnId)); window.clarity("set", "order_amount", String(finalValue)); window.clarity("set", "currency", order.currency || "USD"); window.clarity("set", "storefront", order.domain || order.affiliation || window.location.hostname); window.clarity("set", "payment_method", order.paymentMethod || "online"); window.clarity("set", "items_count", String(items.length || 1)); window.clarity("event", "purchase_completed"); window.clarity("event", "order_created"); window.clarity("identify", String(txnId)); } if (typeof window.cmsSyncAnalyticsSession === 'function') { window.cmsSyncAnalyticsSession(txnId); } if (window.console && console.info) { console.info('[CMS Purchase Tracked]', { transaction_id: txnId, value: finalValue, items: items }); } } } catch (e) { console.warn('[CMS Purchase Track Error]', e); } }; // Automated URL Parameter, Outbound Affiliate Beacon & Checkout Return Interceptor (function() { try { if (typeof window === 'undefined' || !window.location) return; // 1. Delegated click & middle-click (auxclick) listener for /go/* redirects & all outbound affiliate networks function handleAffiliatePointerEvent(ev) { try { if (ev.type === 'auxclick' && ev.button !== 1) return; var goTarget = ev.target && ev.target.closest ? ev.target.closest('a[href*="/go/"], [data-call-track*="/go/"]') : null; if (goTarget) { var rawTrack = goTarget.getAttribute('data-call-track') || goTarget.getAttribute('href') || ''; var goIdx = rawTrack.indexOf('/go/'); if (goIdx !== -1) { var afterGo = rawTrack.substring(goIdx + 4).split('?')[0].split('#')[0]; var segments = afterGo.split('/').filter(Boolean); var slug = segments.length > 1 ? segments[segments.length - 1] : (segments[0] || 'partner'); var hrefAttr = goTarget.getAttribute('href') || ''; var isCall = hrefAttr.indexOf('tel:') === 0 || slug.indexOf('-call') !== -1 || Boolean(goTarget.getAttribute('data-call-track')); var partner = slug.replace(/-call$/, ''); var goText = (goTarget.textContent || '').trim().slice(0, 140); var goNetwork = isCall ? 'click_to_call' : 'affiliate_redirect'; if (!isCall && segments.length > 1) { var firstSeg = segments[0].toLowerCase(); if (firstSeg === 'partnerstack' || firstSeg === 'impact' || firstSeg === 'awin') { goNetwork = firstSeg; } else if (firstSeg === 'network' && segments[1]) { goNetwork = segments[1].toLowerCase(); } } window.cmsTrackAffiliateClick(partner, rawTrack, isCall ? 'call' : 'affiliate_redirect', goText, { affiliateNetwork: goNetwork, affiliateCode: slug }); } return; } var affTarget = ev.target && ev.target.closest ? ev.target.closest('a[href], [data-affiliate], [data-affiliate-partner]') : null; if (!affTarget) return; var affHref = affTarget.getAttribute('href') || affTarget.getAttribute('data-affiliate-url') || ''; if (!affHref || affHref.charAt(0) === '#' || /^(?:javascript|mailto):/i.test(affHref)) return; var parsedUrl; try { parsedUrl = new URL(affHref, window.location.origin); } catch (parseErr) { return; } if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') return; var host = (parsedUrl.hostname || '').toLowerCase().replace(/^www\./, ''); var curHost = (window.location.hostname || '').toLowerCase().replace(/^www\./, ''); var isExternal = Boolean(host && curHost && host !== curHost); var sp = parsedUrl.searchParams; var relAttr = (affTarget.getAttribute('rel') || '').toLowerCase(); var hasSponsoredRel = /(?:^|\s)sponsored(?:\s|$)/.test(relAttr); var explicitPartner = affTarget.getAttribute('data-affiliate-partner') || affTarget.getAttribute('data-affiliate') || ''; var explicitNetwork = affTarget.getAttribute('data-affiliate-network') || ''; var affPartner = ''; var affType = ''; var affNetwork = ''; var affCode = ''; var amzTag = sp.get('tag') || sp.get('AssociateTag') || sp.get('associatetag') || ''; if (((/(?:^|\.)amazon\.[a-z.]{2,}$/i.test(host)) && amzTag) || host === 'amzn.to' || host === 'a.co') { affCode = amzTag; affPartner = amzTag ? ('Amazon Associates (' + amzTag + ')') : 'Amazon Associates'; affType = 'amazon_affiliate'; affNetwork = 'amazon_associates'; } else if (host === 'awin1.com' || host.slice(-10) === '.awin1.com' || sp.get('awinaffid') || sp.get('awinmid')) { affCode = sp.get('awinaffid') || sp.get('awinmid') || ''; affPartner = sp.get('awinmid') === '88085' ? 'CuraDebt (AWIN)' : 'AWIN Partner'; affType = 'awin_affiliate'; affNetwork = 'awin'; } else if (sp.get('fpr') || host === 'dash.skylead.io') { affCode = sp.get('fpr') || ''; affPartner = host.indexOf('skylead') !== -1 ? 'Skylead' : (host || 'FirstPromoter Partner'); affType = 'firstpromoter_affiliate'; affNetwork = 'firstpromoter'; } else if (host === 'ebay.us' || host === 'rover.ebay.com' || ((/(?:^|\.)ebay\.[a-z.]{2,}$/i.test(host)) && (sp.get('campid') || sp.get('mkrid')))) { affCode = sp.get('campid') || sp.get('mkrid') || ''; affPartner = 'eBay Partner Network'; affType = 'ebay_affiliate'; affNetwork = 'ebay_partner_network'; } else if (sp.get('ps_xid') || host === 'partnerstack.com' || host.slice(-17) === '.partnerstack.com' || host.slice(-8) === '.grsm.io') { affCode = sp.get('ps_xid') || ''; affPartner = host || 'PartnerStack Partner'; affType = 'partnerstack_affiliate'; affNetwork = 'partnerstack'; } else if (sp.get('irclickid') || host === 'sjv.io' || host.slice(-7) === '.sjv.io' || host === 'pxf.io' || host.slice(-7) === '.pxf.io' || host === 'evyy.net' || host.slice(-9) === '.evyy.net') { affCode = sp.get('irclickid') || ''; affPartner = host || 'Impact Partner'; affType = 'impact_affiliate'; affNetwork = 'impact'; } else if (sp.get('afcode')) { affCode = sp.get('afcode') || ''; affPartner = host || 'Affiliate Partner'; affType = 'affiliate_referral'; affNetwork = 'direct_affiliate'; } else if (host === 'replit.com' && parsedUrl.pathname.indexOf('/refer/') === 0) { affCode = parsedUrl.pathname.split('/')[2] || ''; affPartner = 'Replit'; affType = 'affiliate_referral'; affNetwork = 'replit_referral'; } else if (host === 'shareasale.com' || host === 'anrdoezrs.net' || host === 'dpbolvw.net' || host === 'jdoqocy.com' || host === 'tkqlhce.com' || host === 'kqzyfj.com' || host === 'hop.clickbank.net') { affPartner = host; affType = 'affiliate_network'; affNetwork = host.indexOf('shareasale') !== -1 ? 'shareasale' : (host.indexOf('clickbank') !== -1 ? 'clickbank' : 'cj_affiliate'); } else if (host === 'affiliatepartners.biz' || host.slice(-22) === '.affiliatepartners.biz') { affPartner = 'AffiliatePartners.biz'; affType = 'outbound_sponsored'; affNetwork = 'affiliatepartners'; } else if (isExternal && (sp.get('aff') || sp.get('affiliate') || sp.get('affiliate_id') || sp.get('partner_ref') || (sp.get('ref') && (host === 'architecturalnumbers.com' || host === 'westonletters.com' || host === 'addressnumbersreviews.com')))) { affCode = sp.get('aff') || sp.get('affiliate') || sp.get('affiliate_id') || sp.get('partner_ref') || sp.get('ref') || ''; affPartner = host; affType = 'partner_affiliate'; affNetwork = 'partner_network'; } else if (hasSponsoredRel || explicitPartner) { affPartner = (explicitPartner && explicitPartner !== 'true' && explicitPartner !== '1') ? explicitPartner : (host || 'Affiliate Partner'); affType = 'outbound_sponsored'; affNetwork = explicitNetwork || 'sponsored'; } else { return; } if (explicitPartner && explicitPartner !== 'true' && explicitPartner !== '1') { affPartner = explicitPartner; } if (explicitNetwork) { affNetwork = explicitNetwork; } var affText = (affTarget.textContent || affTarget.getAttribute('aria-label') || '').trim().slice(0, 140); window.cmsTrackAffiliateClick(affPartner, affHref, affType, affText, { linkDomain: host, affiliateNetwork: affNetwork, affiliateCode: affCode }); } catch (clickErr) {} } document.addEventListener('click', handleAffiliatePointerEvent, true); document.addEventListener('auxclick', handleAffiliatePointerEvent, true); // 2. Attach begin_checkout click listeners on PayPal forms document.addEventListener('DOMContentLoaded', function() { var subForms = document.querySelectorAll('.paypal-sub-form, form[action*="paypal.com"]'); subForms.forEach(function(form) { form.addEventListener('submit', function() { var card = form.closest('.subscription-tier-card'); var tierId = card ? card.getAttribute('data-tier-id') : null; var item = tierId ? window.__CMS_CATALOG[tierId] : null; if (!item) { var nameInput = form.querySelector('input[name="item_name"]'); var priceInput = form.querySelector('input[name="a3"]') || form.querySelector('input[name="amount"]'); item = { id: tierId || 'subscription', name: nameInput ? nameInput.value : 'Subscription', price: priceInput ? parseFloat(priceInput.value) : 0 }; } if (item) { window.cmsTrackBeginCheckout(item); } }); }); }); if (!window.location.search) return; var params = new URLSearchParams(window.location.search); // 3. Check for Full Confirmation-Page Round-Trip on Lead/Quote/Newsletter/Intake Forms var isLeadSuccess = params.get('success') === 'true'; var isNewsletterSuccess = params.get('newsletter_success') === 'true'; var isIntakeSubmitted = params.get('submitted') === 'true'; if (isLeadSuccess || isNewsletterSuccess || isIntakeSubmitted) { if (!window.__cms_lead_tracked) { window.__cms_lead_tracked = true; var path = window.location.pathname.replace(/^\/|\/$/g, '') || 'lead'; var leadType = isNewsletterSuccess ? 'newsletter' : (isIntakeSubmitted ? 'debt_relief' : (path.indexOf('quote') !== -1 ? 'quote' : (path.indexOf('contact') !== -1 ? 'contact' : (path.indexOf('newsletter') !== -1 ? 'newsletter' : (path.indexOf('book') !== -1 ? 'booking' : path))))); window.cmsTrackLead(leadType, { domain: window.location.hostname }); } } // 4. Check for Verified PayPal Checkout Return (only when explicit transaction/order ID is present) var subKey = params.get('subscribed') || params.get('booked'); var txId = params.get('tx') || params.get('subscr_id') || params.get('txn_id') || params.get('orderId'); var amtParam = params.get('amt') || params.get('amount') || params.get('mc_gross'); if (txId && (subKey || amtParam)) { var uniqueTx = txId; var catalogItem = subKey ? window.__CMS_CATALOG[subKey] : null; var price = amtParam ? parseFloat(amtParam) : (catalogItem ? catalogItem.price : 0.00); var itemName = catalogItem ? catalogItem.name : (params.get('item_name') || 'Service Purchase'); var itemId = catalogItem ? catalogItem.id : (subKey || 'custom_order'); var itemCat = catalogItem ? catalogItem.category : 'Digital Services'; var itemBrand = catalogItem ? catalogItem.brand : window.location.hostname; if (price > 0 || catalogItem) { window.cmsTrackPurchase({ orderId: uniqueTx, totalAmount: price, currency: params.get('cc') || params.get('currency_code') || 'USD', affiliation: window.location.hostname, items: [{ id: itemId, name: itemName, category: itemCat, brand: itemBrand, price: price, quantity: 1 }] }); } } } catch (e) { console.warn('[Auto-Listener Error]', e); } })(); // Microsoft Clarity <-> GA4 Cookie & Session Bridge (function() { try { if (typeof window === 'undefined' || window.__cmsClarityBridgeInit) return; window.__cmsClarityBridgeInit = true; function readCookieVal(name) { var pairs = document.cookie ? document.cookie.split('; ') : []; var prefix = name + '='; for (var i = 0; i < pairs.length; i++) { if (pairs[i].indexOf(prefix) === 0) return pairs[i].substring(prefix.length); } return ''; } function parseClarityCookie(raw) { if (!raw) return ''; try { return String(decodeURIComponent(raw).split(/[|^]/)[0] || '').trim(); } catch (e) { return String(String(raw).split(/[|^]/)[0] || '').trim(); } } function parseGaClient(raw) { if (!raw) return ''; var m = String(decodeURIComponent(raw)).match(/^GA\d+\.\d+\.([0-9]+\.[0-9]+)$/); return m ? m[1] : ''; } function parseGaSession(raw) { if (!raw) return ''; var d = String(decodeURIComponent(raw)); var m1 = d.match(/^GS1\.\d+\.([0-9]+)/); if (m1) return m1[1]; var m2 = d.match(/^GS2\.\d+\..*?\bs([0-9]+)/); return m2 ? m2[1] : ''; } function findGaSessionCookie() { var pairs = document.cookie ? document.cookie.split('; ') : []; for (var i = 0; i < pairs.length; i++) { if (pairs[i].indexOf('_ga_') === 0) { var eq = pairs[i].indexOf('='); if (eq !== -1) { var sid = parseGaSession(pairs[i].substring(eq + 1)); if (sid) return sid; } } } return ''; } window.__CMS_ANALYTICS_IDS__ = window.__CMS_ANALYTICS_IDS__ || { clarity_user_id: '', clarity_session_id: '', ga4_client_id: '', ga4_session_id: '' }; window.cmsGetAnalyticsIds = function() { var st = window.__CMS_ANALYTICS_IDS__; var cu = parseClarityCookie(readCookieVal('_clck')); var cs = parseClarityCookie(readCookieVal('_clsk')); var gc = parseGaClient(readCookieVal('_ga')); var gs = findGaSessionCookie(); if (cu) st.clarity_user_id = cu; if (cs) st.clarity_session_id = cs; if (gc && !st.ga4_client_id) st.ga4_client_id = gc; if (gs && !st.ga4_session_id) st.ga4_session_id = gs; if (st.clarity_user_id || st.clarity_session_id || st.ga4_client_id || st.ga4_session_id) { try { document.cookie = 'cms_analytics_ids=' + encodeURIComponent(JSON.stringify({ cu: st.clarity_user_id || '', cs: st.clarity_session_id || '', gc: st.ga4_client_id || '', gs: st.ga4_session_id || '' })) + '; path=/; max-age=1800; SameSite=Lax'; } catch (e) {} } return st; }; window.cmsSyncAnalyticsSession = function(explicitOrderId) { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction()) return; var ids = window.cmsGetAnalyticsIds(); var oid = explicitOrderId || window.__CMS_ACTIVE_ORDER_ID__ || ''; if (!oid && window.location && window.location.search) { oid = new URLSearchParams(window.location.search).get('orderId') || ''; } if (!oid || (!ids.clarity_user_id && !ids.clarity_session_id && !ids.ga4_client_id && !ids.ga4_session_id)) return; if (typeof window.clarity === 'function') { window.clarity('set', 'order_id', String(oid)); window.clarity('set', 'domain', window.location.hostname); } var sig = [oid, ids.clarity_user_id, ids.clarity_session_id, ids.ga4_client_id, ids.ga4_session_id].join('|'); var dedupeKey = 'cms_aid_sync_' + sig; try { if (window.sessionStorage && window.sessionStorage.getItem(dedupeKey) === '1') return; } catch (e) {} if (typeof window.fetch === 'function') { window.fetch('/api/analytics/session', { method: 'POST', keepalive: true, credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ order_id: String(oid), clarity_user_id: ids.clarity_user_id || '', clarity_session_id: ids.clarity_session_id || '', ga4_client_id: ids.ga4_client_id || '', ga4_session_id: ids.ga4_session_id || '' }) }).then(function(r) { if (r && r.ok && window.sessionStorage) { try { window.sessionStorage.setItem(dedupeKey, '1'); } catch (e) {} } }).catch(function() {}); } }; if (typeof window.clarity === 'function') { window.clarity('set', 'domain', window.location.hostname); window.clarity('set', 'ga4_id', 'G-GZM20M9BWQ'); window.clarity('set', 'page_path', window.location.pathname || '/'); } if (typeof gtag === 'function') { try { gtag('get', 'G-GZM20M9BWQ', 'client_id', function(cid) { if (cid) { window.__CMS_ANALYTICS_IDS__.ga4_client_id = String(cid); if (typeof window.clarity === 'function') window.clarity('set', 'ga4_client_id', String(cid)); window.cmsGetAnalyticsIds(); } }); gtag('get', 'G-GZM20M9BWQ', 'session_id', function(sid) { if (sid) { window.__CMS_ANALYTICS_IDS__.ga4_session_id = String(sid); if (typeof window.clarity === 'function') window.clarity('set', 'ga4_session_id', String(sid)); window.cmsGetAnalyticsIds(); } }); } catch (e) {} } window.cmsSendRealtimeBeacon = function() { try { if (typeof window.__cmsIsTestTransaction === 'function' && window.__cmsIsTestTransaction()) return; var ids = window.cmsGetAnalyticsIds(); var sig = [ window.location.hostname || '', window.location.href || '', ids.clarity_user_id || '', ids.clarity_session_id || '' ].join('|'); window.__cms_rt_sent = window.__cms_rt_sent || {}; if (window.__cms_rt_sent[sig]) return; window.__cms_rt_sent[sig] = true; var body = JSON.stringify({ host: window.location.hostname || '', url: window.location.href || '', referrer: document.referrer || '', title: (document.title || '').slice(0, 240), ga4_measurement_id: 'G-GZM20M9BWQ', ga4_client_id: ids.ga4_client_id || '', ga4_session_id: ids.ga4_session_id || '', clarity_project_id: 'ya3pyo34oy', clarity_user_id: ids.clarity_user_id || '', clarity_session_id: ids.clarity_session_id || '' }); if (navigator && typeof navigator.sendBeacon === 'function') { var blob = new Blob([body], { type: 'application/json' }); if (navigator.sendBeacon('/api/analytics/realtime/beacon', blob)) return; } if (typeof window.fetch === 'function') { window.fetch('/api/analytics/realtime/beacon', { method: 'POST', keepalive: true, credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: body }).catch(function() {}); } } catch (e) {} }; window.cmsSendRealtimeBeacon(); setTimeout(function() { if (typeof window.cmsSendRealtimeBeacon === 'function') window.cmsSendRealtimeBeacon(); }, 1800); document.addEventListener('visibilitychange', function() { if (document.visibilityState === 'hidden' && typeof window.cmsSyncAnalyticsSession === 'function') { window.cmsSyncAnalyticsSession(); } }); } catch (bridgeErr) {} })(); </script><script id="cms-cart-meta-bridge">(function(){if(typeof window==="undefined"||window.__cmsCartMetaBridgeReady)return;window.__cmsCartMetaBridgeReady=true;function isTestTx(p){try{if(window.__PAYPAL_ENV__==="sandbox"||window.__IS_HEADLESS_TEST__)return true;if(typeof window.__cmsIsTestTransaction==="function"&&window.__cmsIsTestTransaction(p))return true;if(!p)return false;if(p.isTest===true||p.is_test===true||p.environment==="sandbox")return true;var idStr=String(p.orderId||p.transaction_id||p.transactionId||p._id||"");if(/^(TEST_|test_|ORD_TEST|ORD_SANDBOX|CAP-SANDBOX|WH-BURST|WH-TEST|SALE-|SIM_|FAKE_|MOCK_|SANDBOX_|CHK_|txn_)/i.test(idStr))return true;}catch(e){}return false;}window.cmsDispatchMetaEvent=function(evName,metaParams,eventId){try{if(isTestTx(metaParams))return;if(typeof window.fbq==="function"){if(eventId){window.fbq("track",String(evName),metaParams||{},{eventID:String(eventId)});}else{window.fbq("track",String(evName),metaParams||{});}}}catch(e){}};window.cmsTrackAddToCart=function(itemData,cartCount){try{if(isTestTx(itemData))return;var currency=(itemData&&itemData.currency)||"USD";var host=(window.location&&window.location.hostname)||"storefront";var defBrand=(itemData&&itemData.brand)||host;var defCat=(itemData&&itemData.category)||"Storefront Products";var items=[];var sumVal=0;var totalQty=0;if(itemData&&Array.isArray(itemData.items)&&itemData.items.length>0){for(var i=0;i<itemData.items.length;i++){var r=itemData.items[i]||{};var pr=Number(r.price||0)||0;var qt=Number(r.quantity||r.qty||1)||1;sumVal+=pr*qt;totalQty+=qt;items.push({item_id:String(r.item_id||r.id||r.productID||r.sku||"item"),item_name:String(r.item_name||r.name||r.title||"Product"),item_category:String(r.item_category||r.category||defCat),item_brand:String(r.item_brand||r.brand||defBrand),price:pr,quantity:qt});}}else if(itemData){var sp=Number(itemData.price||0)||0;var sq=Number(itemData.quantity||itemData.qty||1)||1;sumVal=sp*sq;totalQty=sq;items.push({item_id:String(itemData.item_id||itemData.id||itemData.productID||itemData.sku||"item"),item_name:String(itemData.item_name||itemData.name||itemData.title||"Product"),item_category:String(itemData.item_category||itemData.category||defCat),item_brand:String(itemData.item_brand||itemData.brand||defBrand),price:sp,quantity:sq});}var finalVal=(itemData&&typeof itemData.value==="number")?Math.round(itemData.value*100)/100:Math.round(sumVal*100)/100;var first=items[0]||{item_id:"item",item_name:"Product",item_category:defCat};var nowMs=Date.now();var sig=first.item_id+"|"+items.length+"|"+finalVal;if(window.__cmsLastAddToCart&&window.__cmsLastAddToCart.sig===sig&&(nowMs-window.__cmsLastAddToCart.ts)<400)return;window.__cmsLastAddToCart={sig:sig,ts:nowMs};var resolvedCount=(cartCount!==undefined&&cartCount!==null)?cartCount:(totalQty||items.length);if(typeof window.gtag==="function"){window.gtag("event","add_to_cart",{currency:currency,value:finalVal,items:items});}if(typeof window.clarity==="function"){if(resolvedCount!==undefined&&resolvedCount!==null)window.clarity("set","cart_items",String(resolvedCount));if(first.item_name)window.clarity("set","cart_last_item",String(first.item_name));window.clarity("event","add_to_cart");}var evId=(itemData&&itemData.event_id)?String(itemData.event_id):("atc_"+first.item_id+"_"+nowMs);window.cmsDispatchMetaEvent("AddToCart",{content_ids:items.map(function(x){return x.item_id;}),content_name:first.item_name,content_category:first.item_category,content_type:"product",value:finalVal,currency:currency,num_items:totalQty||1},evId);}catch(e){}};if(typeof window.cmsTrackBeginCheckout==="function"&&!window.cmsTrackBeginCheckout.__cmsMetaWrapped){var origBc=window.cmsTrackBeginCheckout;var wrappedBc=function(itemData){origBc.apply(this,arguments);try{if(!itemData||isTestTx(itemData))return;var pr=typeof itemData.price==="number"?itemData.price:(parseFloat(itemData.price)||0);var id=String(itemData.id||itemData.slug||"custom_plan");var nm=String(itemData.name||"Subscription Plan");var cat=String(itemData.category||"Subscriptions");window.cmsDispatchMetaEvent("InitiateCheckout",{content_ids:[id],content_name:nm,content_category:cat,content_type:"product",value:pr,currency:itemData.currency||"USD",num_items:1},itemData.orderId||itemData.order_id||("ic_"+id+"_"+Date.now()));}catch(e){}};wrappedBc.__cmsMetaWrapped=true;window.cmsTrackBeginCheckout=wrappedBc;}if(typeof window.cmsTrackPurchase==="function"&&!window.cmsTrackPurchase.__cmsMetaWrapped){var origPu=window.cmsTrackPurchase;var wrappedPu=function(order){origPu.apply(this,arguments);try{if(!order||isTestTx(order))return;var txnId=String(order.orderId||order.transaction_id||order._id||("TXN_"+Date.now()));if(typeof sessionStorage!=="undefined"){var mk="__cms_meta_tx_"+txnId;if(sessionStorage.getItem(mk))return;sessionStorage.setItem(mk,"1");}var rawItems=Array.isArray(order.items)?order.items:[];var sum=0;var ids=[];var qty=0;for(var i=0;i<rawItems.length;i++){var it=rawItems[i]||{};var p=typeof it.price==="number"?it.price:(parseFloat(it.price)||0);var q=typeof it.quantity==="number"?it.quantity:1;sum+=p*q;qty+=q;ids.push(String(it.productID||it.id||it.item_id||it.slug||"item"));}var val=typeof order.totalAmount==="number"?order.totalAmount:(typeof order.value==="number"?order.value:(parseFloat(order.totalAmount||order.value)||sum));window.cmsDispatchMetaEvent("Purchase",{content_ids:ids.length?ids:[txnId],content_type:"product",value:val,currency:order.currency||"USD",num_items:qty||1},txnId);}catch(e){}};wrappedPu.__cmsMetaWrapped=true;window.cmsTrackPurchase=wrappedPu;}if(typeof window.cmsTrackLead==="function"&&!window.cmsTrackLead.__cmsMetaWrapped){var origLd=window.cmsTrackLead;var wrappedLd=function(type,data){origLd.apply(this,arguments);try{if(isTestTx(data))return;var dom=(data&&data.domain)?data.domain:((window.location&&window.location.hostname)||"site");var lt=type||"contact";var mk="__cms_meta_lead_"+lt;window.__cmsMetaLeads=window.__cmsMetaLeads||{};if(window.__cmsMetaLeads[mk])return;window.__cmsMetaLeads[mk]=true;var fn=(data&&data.form_name)?data.form_name:(dom+" "+lt+" form");var lv=(data&&typeof data.value==="number")?data.value:1.0;window.cmsDispatchMetaEvent("Lead",{content_name:fn,content_category:lt,value:lv,currency:"USD"},(data&&data.event_id)?data.event_id:("lead_"+dom+"_"+lt+"_"+Date.now()));}catch(e){}};wrappedLd.__cmsMetaWrapped=true;window.cmsTrackLead=wrappedLd;}document.addEventListener("click",function(ev){try{var t=ev&&ev.target&&ev.target.closest?ev.target:null;if(!t)return;var atcEl=t.closest("[data-cms-add-to-cart]");if(atcEl&&typeof window.cmsTrackAddToCart==="function"){var raw=atcEl.getAttribute("data-cms-add-to-cart")||"";var pl=null;if(raw&&raw.charAt(0)==="{"){try{pl=JSON.parse(raw);}catch(e){pl=null;}}if(!pl){pl={id:atcEl.getAttribute("data-item-id")||atcEl.getAttribute("data-product-id")||raw||"item",name:atcEl.getAttribute("data-item-name")||(atcEl.textContent||"").trim().slice(0,120)||"Product",price:parseFloat(atcEl.getAttribute("data-item-price")||"0")||0,quantity:parseInt(atcEl.getAttribute("data-item-quantity")||"1",10)||1,category:atcEl.getAttribute("data-item-category")||"Storefront Products"};}window.cmsTrackAddToCart(pl);}var amzEl=t.closest("a[href*=\"/gp/aws/cart/add.html\"]");if(amzEl&&typeof window.cmsTrackAddToCart==="function"){var u=new URL(amzEl.getAttribute("href")||"",window.location.origin);var sp=u.searchParams;var aItems=[];var aQty=0;for(var k=1;k<=20;k++){var asin=sp.get("ASIN."+k);if(!asin)break;var qv=parseInt(sp.get("Quantity."+k)||"1",10)||1;aQty+=qv;aItems.push({item_id:asin,item_name:"Amazon ASIN "+asin,item_category:"Amazon Cart Bundle",item_brand:(window.location&&window.location.hostname)||"storefront",price:0,quantity:qv});}if(aItems.length>0){window.cmsTrackAddToCart({currency:"USD",items:aItems,category:"Amazon Cart Bundle"},aQty);}}}catch(e){}},true);})();</script><script id="cms-csrf-bridge">(function(){if(typeof window==="undefined"||window.__cmsCsrfBridgeReady)return;window.__cmsCsrfBridgeReady=true;var MUTATING_RE=/^(?:POST|PUT|PATCH|DELETE)$/i,TOKEN_RE=/^[A-Za-z0-9_-]{32,128}$/;function readMetaToken(){try{var m=document.querySelector("meta[name=\"csrf-token\"]");var v=m&&m.getAttribute("content")?m.getAttribute("content").trim():"";return TOKEN_RE.test(v)?v:"";}catch(e){return "";}}function cookieName(){return window.location&&window.location.protocol==="https:"?"__Host-csrf":"cms_csrf";}function readCookieToken(){try{var c=document.cookie||"";var m=c.match(/(?:^|;\s*)(?:__Host-csrf|cms_csrf)=([^;]+)/);var v=m?decodeURIComponent(m[1]).trim():"";return TOKEN_RE.test(v)?v:"";}catch(e){return "";}}function mintClientToken(){var bytes=new Uint8Array(32);if(window.crypto&&typeof window.crypto.getRandomValues==="function"){window.crypto.getRandomValues(bytes);}else{for(var i=0;i<32;i++)bytes[i]=Math.floor(Math.random()*256);}var hex="";for(var j=0;j<bytes.length;j++){hex+=("0"+bytes[j].toString(16)).slice(-2);}try{var isHttps=window.location&&window.location.protocol==="https:";document.cookie=cookieName()+"="+hex+"; path=/; SameSite=Lax"+(isHttps?"; Secure":"");}catch(e){}return hex;}function ensureCsrfToken(){return readMetaToken()||readCookieToken()||mintClientToken();}function isSameOriginUrl(u){if(!u)return true;var s=String(u);if(/^mailto:|^tel:|^javascript:/i.test(s))return false;try{return new URL(s,window.location.origin).origin===window.location.origin;}catch(e){return s.charAt(0)==="/";}}function syncSingleForm(form,tok){if(!form||!form.getAttribute)return;var method=(form.getAttribute("method")||"").toUpperCase();if(!MUTATING_RE.test(method))return;var action=form.getAttribute("action")||"";if(action&&!isSameOriginUrl(action))return;var inp=form.querySelector("input[name=\"_csrf\"]");if(!inp){inp=document.createElement("input");inp.type="hidden";inp.name="_csrf";form.appendChild(inp);}inp.value=tok;var enc=(form.enctype||form.getAttribute("enctype")||"").toLowerCase();if(enc==="multipart/form-data"){try{var u=new URL(action||window.location.href,window.location.origin);if(u.origin===window.location.origin){u.searchParams.set("_csrf",tok);form.setAttribute("action",u.pathname+u.search+u.hash);}}catch(e){}}}function syncAllForms(){try{var tok=ensureCsrfToken();var forms=document.querySelectorAll("form");for(var i=0;i<forms.length;i++)syncSingleForm(forms[i],tok);var qs=window.location&&window.location.search?window.location.search:"";if(qs.indexOf("error=csrf_retry")!==-1){for(var k=0;k<forms.length;k++){var f=forms[k];if(MUTATING_RE.test(f.getAttribute("method")||"")&&isSameOriginUrl(f.getAttribute("action")||"")){var notice=f.querySelector(".cms-csrf-retry-msg");if(!notice){notice=document.createElement("div");notice.className="cms-recaptcha-error-msg cms-csrf-retry-msg";notice.setAttribute("role","alert");notice.style.cssText="grid-column:1 / -1;width:100%;color:#b91c1c;background:rgba(220,38,38,.1);border:1px solid rgba(220,38,38,.38);border-radius:6px;padding:10px 12px;margin:10px 0;font-size:.9rem;font-weight:500;box-sizing:border-box";f.insertBefore(notice,f.firstChild);}notice.textContent="Your security session was refreshed. Please click submit once more.";break;}}if(window.history&&typeof window.history.replaceState==="function"){try{var cleanUrl=new URL(window.location.href);cleanUrl.searchParams.delete("error");window.history.replaceState(null,"",cleanUrl.pathname+cleanUrl.search+cleanUrl.hash);}catch(e){}}}}catch(e){}}if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",syncAllForms);}else{syncAllForms();}document.addEventListener("submit",function(ev){try{if(ev&&ev.target)syncSingleForm(ev.target,ensureCsrfToken());}catch(e){}},true);if(typeof window.fetch==="function"&&!window.__cmsCsrfFetchWrapped){window.__cmsCsrfFetchWrapped=true;var origFetch=window.fetch.bind(window);window.fetch=function(input,init){try{var url=typeof input==="string"?input:(input&&input.url?input.url:"");var method=(init&&init.method?init.method:(input&&input.method?input.method:"GET")).toUpperCase();if(MUTATING_RE.test(method)&&isSameOriginUrl(url)){var tok=ensureCsrfToken();if(tok){var nextInit=Object.assign({},init||{});var hdrs=nextInit.headers||(typeof Request!=="undefined"&&input instanceof Request?input.headers:undefined);if(typeof Headers!=="undefined"&&hdrs instanceof Headers){var cloned=new Headers(hdrs);if(!cloned.has("X-CSRF-Token")&&!cloned.has("x-csrf-token"))cloned.set("X-CSRF-Token",tok);nextInit.headers=cloned;}else if(Array.isArray(hdrs)){var copy=hdrs.slice();var exists=copy.some(function(p){return p&&String(p[0]).toLowerCase()==="x-csrf-token";});if(!exists)copy.push(["X-CSRF-Token",tok]);nextInit.headers=copy;}else{var obj=Object.assign({},hdrs||{});if(!obj["X-CSRF-Token"]&&!obj["x-csrf-token"])obj["X-CSRF-Token"]=tok;nextInit.headers=obj;}init=nextInit;}}}catch(e){}return origFetch(input,init);};}if(typeof XMLHttpRequest!=="undefined"&&XMLHttpRequest.prototype&&!XMLHttpRequest.prototype.__cmsCsrfWrapped){XMLHttpRequest.prototype.__cmsCsrfWrapped=true;var origOpen=XMLHttpRequest.prototype.open,origSetHeader=XMLHttpRequest.prototype.setRequestHeader,origSend=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(method,url){this.__cmsCsrfMethod=String(method||"GET").toUpperCase();this.__cmsCsrfUrl=String(url||"");this.__cmsCsrfHeaderSet=false;return origOpen.apply(this,arguments);};XMLHttpRequest.prototype.setRequestHeader=function(name,val){if(name&&/^x-[cx]srf-token$/i.test(String(name)))this.__cmsCsrfHeaderSet=true;return origSetHeader.apply(this,arguments);};XMLHttpRequest.prototype.send=function(){try{if(!this.__cmsCsrfHeaderSet&&MUTATING_RE.test(this.__cmsCsrfMethod||"")&&isSameOriginUrl(this.__cmsCsrfUrl||"")){var tok=ensureCsrfToken();if(tok)origSetHeader.call(this,"X-CSRF-Token",tok);}}catch(e){}return origSend.apply(this,arguments);};}})();</script></body> </html>