diff --git a/apps/genetics/index.html b/apps/genetics/index.html
index 0e5539149..ef751f3be 100644
--- a/apps/genetics/index.html
+++ b/apps/genetics/index.html
@@ -23,7 +23,8 @@
-
+
+
Open Targets Genetics
diff --git a/apps/genetics/public/matomo/get_logged_in_user.js b/apps/genetics/public/matomo/get_logged_in_user.js
new file mode 100644
index 000000000..162e8e72e
--- /dev/null
+++ b/apps/genetics/public/matomo/get_logged_in_user.js
@@ -0,0 +1,24 @@
+/**
+Returns a promise of logged-in user id.
+This function assumes response header contains 'user' entry.
+*/
+function getLoggedInUser() {
+ return new Promise(function(resolve, reject) {
+ var request = new XMLHttpRequest();
+ request.onreadystatechange = function() {
+ if (this.readyState === this.HEADERS_RECEIVED) {
+ var user = request.getResponseHeader('user');
+ if (user != null) {
+ resolve(user);
+ } else {
+ reject();
+ }
+ }
+ };
+ request.onerror = function() {
+ reject();
+ };
+ request.open('HEAD', document.location, true);
+ request.send(null);
+ });
+}
\ No newline at end of file
diff --git a/apps/genetics/public/matomo/init_matomo.js b/apps/genetics/public/matomo/init_matomo.js
new file mode 100644
index 000000000..fc4786055
--- /dev/null
+++ b/apps/genetics/public/matomo/init_matomo.js
@@ -0,0 +1,40 @@
+var _paq = window._paq || [];
+/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
+
+(function() {
+ function registerUserVisit() {
+ getLoggedInUser()
+ .then(function(user) {
+ _paq.push(['setUserId', user]);
+ })
+ .finally(function() {
+ _paq.push(['setCustomUrl', window.location.href]);
+ _paq.push(['setDocumentTitle', window.document.title]);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ });
+ }
+ var pushState = history.pushState;
+ history.pushState = function() {
+ pushState.apply(history, arguments);
+ registerUserVisit();
+ };
+ registerUserVisit();
+})();
+
+(function() {
+ var u = 'DISABLED';
+ if (u === 'DISABLED') {
+ return
+ }
+ _paq.push(['setTrackerUrl', u + 'matomo.php']);
+ _paq.push(['setSiteId', '1']);
+ var d = document,
+ g = d.createElement('script'),
+ s = d.getElementsByTagName('script')[0];
+ g.type = 'text/javascript';
+ g.async = true;
+ g.defer = true;
+ g.src = u + 'matomo.js';
+ s.parentNode.insertBefore(g, s);
+})();
\ No newline at end of file