White Pass Retreats

undefined Results

/* White Pass Retreats - GA4 cta_click tracking */ (function () { if (window.__wprCtaInstalled) return; window.__wprCtaInstalled = true; function fire(ctaType, el) { var payload = { cta_type: ctaType, page_path: location.pathname || '/', link_url: (el && el.getAttribute && (el.getAttribute('href') || '')) || '' }; if (typeof window.gtag === 'function') { window.gtag('event', 'cta_click', payload); } else { (window.dataLayer = window.dataLayer || []).push( Object.assign({ event: 'cta_click' }, payload) ); } } var lastKey = '', lastTime = 0; function dedupe(key) { var now = Date.now(); if (key === lastKey && (now - lastTime) < 800) return false; lastKey = key; lastTime = now; return true; } function classify(target) { var a = target.closest && target.closest('a, button, [role="button"], [data-testid]'); if (!a) return null; var href = (a.getAttribute && (a.getAttribute('href') || '')) || ''; var testid = (a.getAttribute && (a.getAttribute('data-testid') || '')) || ''; var text = (a.textContent || '').trim().toLowerCase(); if (href.indexOf('tel:') === 0) return 'phone_click'; if (/\/contact-us/.test(href) || text === 'contact us') return 'contact_us'; if (/checkout\.lodgify\.com/.test(href) || /\/reservation/.test(href) || /\bbook now\b/.test(text)) return 'book_now'; if (/date-picker/.test(testid)) return 'availability_search'; if (href.indexOf('#sect') === 0 && text === 'availability') return 'availability_search'; return null; } document.addEventListener('click', function (e) { try { var type = classify(e.target); if (!type) return; var a = e.target.closest('a, button, [role="button"], [data-testid]'); var key = type + '|' + ((a && a.getAttribute && (a.getAttribute('href') || a.getAttribute('data-testid'))) || ''); if (!dedupe(key)) return; fire(type, a); } catch (err) { /* never break the page */ } }, true); })();