Thermal Break Doors Texas | Iron & Aluminum | Texas Glass Door
Skip to content
- Choosing a selection results in a full page refresh.
- Opens in a new window.
, or via GTM Custom HTML / Custom Pixel if allowed.
* GA4 detected on site: G-PJ9BC17DZS
*/
(function () {
if (window.__tgdGa4LeadTrackingInstalled) return;
window.__tgdGa4LeadTrackingInstalled = true;
function sendEvent(name, params) {
params = params || {};
params.page_location = location.href;
params.page_path = location.pathname + location.search;
params.event_source = 'tgd_lead_tracking';
if (typeof window.gtag === 'function') {
window.gtag('event', name, params);
}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(Object.assign({ event: name }, params));
}
function textOf(el) {
return ((el && (el.innerText || el.textContent)) || '').replace(/\s+/g, ' ').trim().slice(0, 160);
}
document.addEventListener('click', function (e) {
var a = e.target.closest && e.target.closest('a[href]');
var btn = e.target.closest && e.target.closest('button, [role="button"], .storeify-quote-btn-trigger-popup');
if (a) {
var href = a.getAttribute('href') || '';
var lower = href.toLowerCase();
if (lower.indexOf('tel:') === 0) {
sendEvent('phone_click', { link_url: href, link_text: textOf(a) });
} else if (lower.indexOf('mailto:') === 0) {
sendEvent('email_click', { link_url: href, link_text: textOf(a) });
} else if (lower.indexOf('docs.google.com/forms') !== -1) {
sendEvent('quote_request_click', { link_url: href, link_text: textOf(a), quote_source: 'google_form' });
}
}
if (btn) {
var label = textOf(btn);
var cls = btn.className || '';
if (/request\s*a\s*quote|get\s*quote|quote/i.test(label) || String(cls).indexOf('storeify-quote-btn') !== -1) {
sendEvent('quote_request_click', {
link_text: label || 'Request a Quote',
product_handle: btn.getAttribute('data-product') || '',
quote_source: 'storeify_quote_button'
});
}
}
}, true);
document.addEventListener('submit', function (e) {
var form = e.target;
if (!form || !form.matches) return;
var id = form.getAttribute('id') || '';
var action = form.getAttribute('action') || '';
var formType = (form.querySelector('[name="form_type"]') || {}).value || '';
if (id === 'ContactForm' || action.indexOf('/contact') !== -1 || formType === 'contact') {
sendEvent('form_submit', { form_id: id || 'contact_form', form_type: formType || 'contact' });
sendEvent('generate_lead', { lead_type: 'contact_form', form_id: id || 'contact_form' });
}
}, true);
})();