diff --git a/docs/GoogleAnalytics.js b/docs/GoogleAnalytics.js
new file mode 100644
index 00000000000..f1ae6368add
--- /dev/null
+++ b/docs/GoogleAnalytics.js
@@ -0,0 +1,20 @@
+class GoogleAnalytics {
+
+ static click_batchcode(batchcode) {
+ gtag(
+ 'event',
+ 'click_batchcode',
+ {
+ 'batchcode': batchcode
+ });
+ }
+
+ static view_search_results(search_term) {
+ gtag(
+ 'event',
+ 'view_search_results',
+ {
+ 'search_term': search_term
+ });
+ }
+}
diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html
index 4def163bfdf..1e5cb8aad10 100644
--- a/docs/batchCodeTable.html
+++ b/docs/batchCodeTable.html
@@ -31,6 +31,7 @@
+
diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js
index 2525ddd9121..23b3882b395 100644
--- a/docs/batchCodeTable.js
+++ b/docs/batchCodeTable.js
@@ -155,12 +155,7 @@ class BatchCodeTableInitializer {
tr.addClass('shown');
const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')];
new HistogramView(uiContainer).displayHistogramView(thisClassInstance.#getCountry(), batchcode);
- gtag(
- 'event',
- 'click_batchcode',
- {
- 'batchcode': batchcode
- });
+ GoogleAnalytics.click_batchcode(batchcode);
}
});
}
@@ -171,12 +166,7 @@ class BatchCodeTableInitializer {
.on(
'search.dt',
function () {
- gtag(
- 'event',
- 'view_search_results',
- {
- 'search_term': thisClassInstance.#batchCodeTable.search().toUpperCase()
- });
+ GoogleAnalytics.view_search_results(thisClassInstance.#batchCodeTable.search().toUpperCase());
});
}
}