From a8f8b94414780c1fd0fd953719aff4eeecb138a1 Mon Sep 17 00:00:00 2001 From: Nicola Tarocco Date: Mon, 7 Dec 2020 21:50:52 +0100 Subject: [PATCH] Fix Piwik URL * closes #49 --- README.md | 6 ++-- cara/apps/static/js/usage-tracking.js | 44 ++++++++++++++------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index d7479e70..cbf9956d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Applications -### COVID Calculator +### COVID Calculator A risk assessment tool which simulates the long range airborne spread of the SARS-CoV-2 virus for space managers. @@ -61,8 +61,8 @@ The https://cern.ch/cara application is running on CERN's OpenShift platform. In ### Updating the test-cara.web.cern.ch instance We have a replica of https://cara.web.cern.ch running on http://test-cara.web.cern.ch. Its purpose is to simulate what will happen when -a feature is merged. To push your changes to test-cara, simply push your branch to live/test-cara and the CI pipeline will trigger the -deployment. To push a to this branch, there is a good chance you will need to force push - you should always force push with care and +a feature is merged. To push your changes to test-cara, simply push your branch to `live/test-cara` and the CI pipeline will trigger the +deployment. To push to this branch, there is a good chance that you will need to force push - you should always force push with care and understanding why you are doing it. Syntactically, it will looks something like (assuming that you have "upstream" as your remote name, but it may be origin if you haven't configured it differently): diff --git a/cara/apps/static/js/usage-tracking.js b/cara/apps/static/js/usage-tracking.js index 4a1512e8..1e12172c 100644 --- a/cara/apps/static/js/usage-tracking.js +++ b/cara/apps/static/js/usage-tracking.js @@ -1,37 +1,39 @@ if (document.location.hostname == "test-cara.web.cern.ch") { var _paq = _paq || []; - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); + _paq.push(["trackPageView"]); + _paq.push(["enableLinkTracking"]); (function () { - var u = "//piwikui.web.cern.ch/piwikui/"; - _paq.push(['setTrackerUrl', u + 'piwik.php']); - _paq.push(['setSiteId', '7615']); + var u = "//piwik.web.cern.ch/"; + _paq.push(["setTrackerUrl", u + "piwik.php"]); + _paq.push(["setSiteId", "7615"]); var d = document, - g = d.createElement('script'), - s = d.getElementsByTagName('script')[0]; - g.type = 'text/javascript'; + g = d.createElement("script"), + s = d.getElementsByTagName("script")[0]; + g.type = "text/javascript"; g.async = true; g.defer = true; - g.src = u + 'piwik.js'; + g.src = u + "piwik.js"; s.parentNode.insertBefore(g, s); })(); -} else if (document.location.hostname == 'cara.web.cern.ch') { +} else if (document.location.hostname == "cara.web.cern.ch") { var _paq = _paq || []; - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); + _paq.push(["trackPageView"]); + _paq.push(["enableLinkTracking"]); (function () { - var u = "//piwikui.web.cern.ch/piwikui/"; - _paq.push(['setTrackerUrl', u + 'piwik.php']); - _paq.push(['setSiteId', '7616']); + var u = "//piwik.web.cern.ch/"; + _paq.push(["setTrackerUrl", u + "piwik.php"]); + _paq.push(["setSiteId", "7616"]); var d = document, - g = d.createElement('script'), - s = d.getElementsByTagName('script')[0]; - g.type = 'text/javascript'; + g = d.createElement("script"), + s = d.getElementsByTagName("script")[0]; + g.type = "text/javascript"; g.async = true; g.defer = true; - g.src = u + 'piwik.js'; + g.src = u + "piwik.js"; s.parentNode.insertBefore(g, s); })(); } else { - console.log("Usage tracking disabled for hostname: " + document.location.hostname); -} \ No newline at end of file + console.log( + "Usage tracking disabled for hostname: " + document.location.hostname + ); +}