From c22006b78e1dcd90f59b6fd55f28f53cf5d97738 Mon Sep 17 00:00:00 2001 From: frankknoll Date: Sun, 19 Mar 2023 22:41:24 +0100 Subject: [PATCH] BatchCodeTableInitializer.#trackSearchWithGoogleAnalytics() --- docs/batchCodeTable.html | 264 ++++++++++++++++++++++++++++----------- docs/batchCodeTable.js | 51 +++++--- src/help.txt | 1 + 3 files changed, 227 insertions(+), 89 deletions(-) diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html index 455459b8738..4def163bfdf 100644 --- a/docs/batchCodeTable.html +++ b/docs/batchCodeTable.html @@ -1,35 +1,42 @@ + - - -Batch Codes of Coronavirus 2019 Vaccines - - - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + -Fork me on GitHub -

Batch Codes of Coronavirus 2019 Vaccines

-

- -

-

-

-Check out your batch code (Last updated: March 17, 2023) + Fork me on GitHub +

Batch Codes of Coronavirus 2019 Vaccines

+

+

- - - - - - - - - - - - - - - -
BatchAdverse Reaction ReportsDeathsDisabilitiesLife Threatening IllnessesCompanyCountriesSevere reportsLethality
-

Data Source: -Vaccine Adverse Event Reporting System +

+

+ Check out your batch code (Last updated: March 17, 2023) +

+ + + + + + + + + + + + + + + +
BatchAdverse Reaction ReportsDeathsDisabilitiesLife Threatening IllnessesCompanyCountriesSevere reportsLethality
+

Data Source: + Vaccine Adverse Event Reporting System (VAERS) -

- - + + \ No newline at end of file diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js index cdc99ab030a..b904970b534 100644 --- a/docs/batchCodeTable.js +++ b/docs/batchCodeTable.js @@ -18,6 +18,7 @@ class BatchCodeTableInitializer { this.#countrySelect.addEventListener('change', event => this.#displayCountry()); this.#displayCountry(); this.#initializeHistogramView(); + this.#trackSearchWithGoogleAnalytics(); } #getCountry() { @@ -135,22 +136,38 @@ class BatchCodeTableInitializer { #initializeHistogramView() { const thisClassInstance = this; - $(`#${this.#batchCodeTableElement[0].id} tbody`).on( - 'click', - 'td.dt-control', - function () { - const tr = $(this).closest('tr'); - const row = thisClassInstance.#batchCodeTable.row(tr); - if (row.child.isShown()) { - row.child.hide(); - tr.removeClass('shown'); - } else { - const uiContainer = document.createElement("div"); - row.child(uiContainer).show(); - tr.addClass('shown'); - const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')]; - new HistogramView(uiContainer).displayHistogramView(thisClassInstance.#getCountry(), batchcode); - } - }); + $(`#${this.#batchCodeTableElement[0].id} tbody`) + .on( + 'click', + 'td.dt-control', + function () { + const tr = $(this).closest('tr'); + const row = thisClassInstance.#batchCodeTable.row(tr); + if (row.child.isShown()) { + row.child.hide(); + tr.removeClass('shown'); + } else { + const uiContainer = document.createElement("div"); + row.child(uiContainer).show(); + tr.addClass('shown'); + const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')]; + new HistogramView(uiContainer).displayHistogramView(thisClassInstance.#getCountry(), batchcode); + } + }); + } + + #trackSearchWithGoogleAnalytics() { + const thisClassInstance = this; + $(`#${this.#batchCodeTableElement[0].id}`) + .on( + 'search.dt', + function () { + gtag( + 'event', + 'view_search_results', + { + 'search_term': thisClassInstance.#batchCodeTable.search() + }); + }); } } diff --git a/src/help.txt b/src/help.txt index a2ba76d686e..72fc8945b8e 100644 --- a/src/help.txt +++ b/src/help.txt @@ -3,6 +3,7 @@ jupyter notebook FK-FIXME: FK-TODO: +- add google captcha to batchCodeTable.html anacron job: sudo cp src/intensivstationen_howbadismybatch.sh /etc/cron.daily/intensivstationen_howbadismybatch