Skip to content

Commit 0f89960

Browse files
author
Pat Mellon
committed
Update analytics to capture star ratings
1 parent 6ce4bb0 commit 0f89960

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

_templates/layout.html

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,22 @@
4747
});
4848
});
4949

50-
$("[data-behavior='was-this-helpful-event']").on('click', function(){
51-
$(".helpful-question").hide();
52-
$(".was-helpful-thank-you").show();
53-
54-
fbq('trackCustom', "Was this Helpful?", {
50+
$("[data-behavior='tutorial-rating']").on('click', function(){
51+
fbq('trackCustom', "Tutorial Rating", {
5552
tutorialLink: window.location.href,
5653
tutorialTitle: $('h1:first').text(),
57-
helpful: $(this).attr("data-response")
58-
});
59-
60-
gtag('event', $(this).attr("data-response"), {
61-
'event_category': 'Was this Helpful?',
62-
'event_label': $(this).attr("data-response")
54+
rating: $(this).attr("data-count")
6355
});
6456

65-
gtag('event', $(this).attr("data-response"), {
66-
'event_category': 'Was this Helpful?',
67-
'event_label': $("h1").first().text()
57+
gtag('event', 'click', {
58+
'event_category': 'Tutorial Rating',
59+
'event_label': $("h1").first().text(),
60+
'value': $(this).attr("data-count")
6861
});
6962
});
7063

7164
if (location.pathname == "/") {
72-
$(".helpful-container").hide();
65+
$(".rating-container").hide();
7366
$(".hr-bottom").hide();
7467
}
7568
</script>

0 commit comments

Comments
 (0)