Skip to content

Commit

Permalink
Docs: Fix feedback button (#8035)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkatz authored Aug 2, 2024
1 parent d1cfd7f commit 4c4c44b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/assets/js/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ $(() => {
})
setTimeout(close, 10000);
}
$(".page-helpful-btn").on("click", (e) => showThankYou(e.target))

const sendFeedbackEvent = (elm) => {
if (window.dataLayer === undefined) return; // GA4 is not loaded on this page
const isHelpful = elm.id.substr("page-helpful-".length) === "yes";
window.dataLayer.push("event", "click_docs_feedback", {
"page_title": window.document.title,
"reaction": isHelpful ? "thumbs_up" : "thumbs_down",
});
}

$(".page-helpful-btn").on("click", (e) => {
const elm = e.target;
sendFeedbackEvent(elm);
showThankYou(elm);
});
$('#is-helpful-ty').on("click", (e) => $(e.target).prop("tagName") === 'A')
})

0 comments on commit 4c4c44b

Please sign in to comment.