From: Radek Czajka Date: Tue, 13 Sep 2022 07:38:02 +0000 (+0200) Subject: Track HTML events. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/807d88a6bbd34865987b59a757e7b4ef3b3fc718?hp=190a12c5524f533a5fa74569575cccf22f745847 Track HTML events. --- diff --git a/src/wolnelektury/static/js/book_text/menu.js b/src/wolnelektury/static/js/book_text/menu.js index 5bbc1a8d8..eff64a0c6 100644 --- a/src/wolnelektury/static/js/book_text/menu.js +++ b/src/wolnelektury/static/js/book_text/menu.js @@ -30,6 +30,7 @@ $('#menu-toggle-on').click(function(e) { if (!$("#menu").is(":visible")) { body.addClass("menu-showed"); } + _paq.push(['trackEvent', 'html', 'menu-on']); }); /* Hide menu */ @@ -42,6 +43,7 @@ $('#menu-toggle-off').click(function(e) { if ($("#menu").is(":visible")) { $("body").addClass("menu-hidden"); } + _paq.push(['trackEvent', 'html', 'menu-off']); }); @@ -53,7 +55,7 @@ $("#box-underlay").click(release_menu); $("#menu a").each(function() { var boxid = $(this).attr("data-box"); if (boxid) { - $("#" + $(this).attr("data-box")).hide(); + $("#" + boxid).hide(); $(this).click(function(e) { e.preventDefault(); @@ -63,9 +65,10 @@ $("#menu a").each(function() { $("body").addClass("menu-showed"); $(this).addClass("active"); $("#box-underlay").show(); - $("#" + $(this).attr("data-box")).show(); + $("#" + boxid).show(); } }); + _paq.push(['trackEvent', 'html', boxid]); } else if ($(this).hasClass('dropdown')) { $(this).click(function(e) { @@ -107,6 +110,7 @@ $(".display-other").click(function(e) { loaded_text($("#other-text-body")); } }); + _paq.push(['trackEvent', 'html', 'other-text']); }); @@ -117,11 +121,15 @@ $(".other-text-close").click(function(e) { $("#other-text").hide(); $("body").removeClass('with-other-text'); $("#other-text-body").html(""); + _paq.push(['trackEvent', 'html', 'other-text-close']); }); /* Release menu after clicking inside TOC. */ -$("#toc a").click(release_menu); + $("#toc a").click(function(){ + release_menu(); + _paq.push(['trackEvent', 'html', 'toc-item']); + }); if ($('#nota_red').length > 0) { diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js index b9fc40f86..795c737f2 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -97,5 +97,7 @@ $("#reference-link").text(ref.label); $("#reference-link").attr('href', ref.wikipedia_link); + + _paq.push(['trackEvent', 'html', 'reference']); }); })})(jQuery); diff --git a/src/wolnelektury/static/js/book_text/settings.js b/src/wolnelektury/static/js/book_text/settings.js index e398ba3ed..96fb6c4cb 100644 --- a/src/wolnelektury/static/js/book_text/settings.js +++ b/src/wolnelektury/static/js/book_text/settings.js @@ -6,6 +6,7 @@ $("#menu-settings").show(); $(".settings-switch").click(function(e) { e.preventDefault(); $("body").toggleClass($(this).attr("data-setting")); + _paq.push(['trackEvent', 'html', $(this).attr("data-setting")]); });