Skip to content

Commit 29e7620

Browse files
authored
Update analytics to capture star ratings (#1358)
1 parent 2337ff5 commit 29e7620

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
@@ -48,29 +48,22 @@
4848
});
4949
});
5050

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

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

7265
if (location.pathname == "/") {
73-
$(".helpful-container").hide();
66+
$(".rating-container").hide();
7467
$(".hr-bottom").hide();
7568
}
7669
</script>

0 commit comments

Comments
 (0)