function footerNavTracking() {
const footerWrapper = document.querySelector(".footer__wrapper");
if (!footerWrapper) return;
footerWrapper.addEventListener("click", (e) => {
// Find the closest relevant link
const link = e.target.closest(
".footer__col-second-button_wrapper a, .footer__logo-link",
);
if (!link) return;
e.preventDefault();
// Get the URL from the <a> tag
const url = link.getAttribute("href") || "";
// Social links
if (link.matches(".footer__col-second-button_wrapper a")) {
// Get the visible text (after the span/SVG)
const linkTextRaw = link.lastChild.textContent.trim();
const linkText = linkTextRaw.replace(/\s+/g, " ").trim() || "";
gtmPush({
event: "navigation_click",
navigation_type: "footer_nav",
click_text: linkText,
click_url: url,
level: 1,
});
}
// Logo links
if (link.matches(".footer__logo-link")) {
const linkTextRaw =
link.querySelector("svg title")?.textContent || "";
const linkText = linkTextRaw.replace(/\s+/g, " ").trim() || "";
const url = link.getAttribute("href") || "";
gtmPush({
event: "navigation_click",
navigation_type: "footer_nav",
click_text: linkText,
click_url: url,
level: 1,
});
}
});
}