blog-rekahsoft-ca/templates/partials/analytics.html
Collin J. Doering 9171aa88ad
Replace broken piwiki analytics with self-hosted plausible
* templates/partials/analytics.html: Upon a client load of the website, determine which site
they are viewing (dev, staging, production) and setup plausible analytics appropriately.

* templates/default.html: Remove non-functional piwiki script reference and replace with a
reference to the new partial template for analytics

* src/site.hs (main): Remove remnant of application cache support

* js/default.js: Remove unneeded analytics code specific to piwiki. No additions were made here in support of plausible

* TODO.org: Mark associated TODO item DONE
2021-12-18 20:37:59 -05:00

22 lines
750 B
HTML

<script>
var ref = document.createElement("script");
ref.setAttribute("type", "text/javascript");
var script = "https://analytics.rekahsoft.ca/js/plausible.js";
switch (window.location.hostname) {
case "www.blog.rekahsoft.ca":
ref.setAttribute("data-domain", "blog.rekahsoft.ca");
break;
case "www.blog.staging.rekahsoft.ca":
ref.setAttribute("data-domain", "blog.staging.rekahsoft.ca");
break;
default:
script = "https://analytics.rekahsoft.ca/js/plausible.exclusions.local.js";
ref.setAttribute("data-domain", "localhost:3000");
ref.setAttribute("data-exclude", "localhost:3000");
}
ref.setAttribute("src", script);
document.getElementsByTagName("head")[0].appendChild(ref)
</script>