Xsquare Technology

Scroll to Top
* * Fires gtag('event','generate_lead', ...) only after a real Elementor * Pro form success (jQuery submit_success). Does not fire on validation * errors. Sends no names, emails, phones or message text. * * Known Elementor form IDs (for form_name labels only): * 89fd603 Contact Us page form * c7c5523 Homepage "Make An Free IT Consultant" form * 5bd3a46 "Get A Quote" popup (Elementor library 3155) * e74addf Careers "Apply" popup (Elementor library 4196) */ (function () { 'use strict';if (window.__xsquareGenerateLeadBound) { return; } window.__xsquareGenerateLeadBound = true;var FORM_NAMES = { '89fd603': 'Contact Us', 'c7c5523': 'Homepage IT Consultant', '5bd3a46': 'Get A Quote', 'e74addf': 'Careers Apply' };function sendEvent(params) { var fn = null; if (typeof window.gtag === 'function') { fn = window.gtag; } else if (typeof window.__gtagTracker === 'function') { fn = window.__gtagTracker; } if (!fn) { return; } fn('event', 'generate_lead', params); }function formIdFrom(form) { if (!form || !form.querySelector) { return ''; } var input = form.querySelector('input[name="form_id"]'); return input && input.value ? String(input.value) : ''; }function leadParams(form) { var id = formIdFrom(form); var attrName = (form && form.getAttribute && form.getAttribute('name')) || ''; var label = FORM_NAMES[id] || attrName || (id ? 'elementor_form_' + id : 'elementor_form'); return { form_name: label, form_id: id || '(not set)', page_location: window.location.href, page_path: window.location.pathname }; }// Guard against a plugin firing submit_success twice for one send. var lastKey = ''; var lastAt = 0; function fireOnce(form) { var key = (formIdFrom(form) || (form && form.name) || 'form') + '|' + window.location.pathname; var now = Date.now(); if (key === lastKey && (now - lastAt) < 2000) { return; } lastKey = key; lastAt = now; sendEvent(leadParams(form)); }function bind(jq) { if (!jq || jq.__xsquareLeadBound) { return; } jq.__xsquareLeadBound = true; jq(document).on('submit_success', function (event) { var form = event && event.target; if (!form) { return; } var isElementor = (form.classList && form.classList.contains('elementor-form')) || (form.tagName && form.tagName.toLowerCase() === 'form' && form.querySelector && form.querySelector('input[name="form_id"]')); if (!isElementor) { return; } fireOnce(form); }); }function waitForJQuery() { if (window.jQuery) { bind(window.jQuery); return; } var n = 0; var t = window.setInterval(function () { if (window.jQuery) { window.clearInterval(t); bind(window.jQuery); } else if (++n > 50) { window.clearInterval(t); } }, 200); }if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', waitForJQuery); } else { waitForJQuery(); } })();