Untitled

mail@pastecode.io avatar
unknown
javascript
2 months ago
448 B
2
Indexable
Never
const botones_menu = document.querySelectorAll(".drl-menu-item");
botones_menu.forEach((item) => {
  item.addEventListener("click", () => {
    const label_item = item.querySelector("span").textContent;
    const text_item = label_item.replace(/\s+/g, "_");
    dataLayer.push({
      event: "custom_click",
      event_category: "header",
      event_action: "menu",
      event_label: label_item,
      clicked_text: text_item,
    });
  });
});
Leave a Comment