Blog - GoAdventure

;
document.addEventListener("DOMContentLoaded", () => { const observeWidget = () => { const widget = document.querySelector('[data-id="zsalesiq"]'); if (widget) { widget.addEventListener("click", () => { // Fire a custom event to Google Tag Manager if (window.dataLayer) { window.dataLayer.push({ event: "chatWidgetClick", }); } console.log("Zoho chat widget clicked"); }); } else { // Retry if the widget isn't available yet setTimeout(observeWidget, 500); } }; observeWidget(); });