1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:16:40 -04:00

remove frontend analytics

This commit is contained in:
2021-06-01 07:47:11 -04:00
parent 78518fe326
commit 4bb5841ac1
9 changed files with 9 additions and 173 deletions

View File

@ -7,13 +7,7 @@
[![GitHub repo size](https://img.shields.io/github/repo-size/jakejarvis/jarv.is?color=009cdf&label=repo%20size&logo=git&logoColor=white)](https://github.com/jakejarvis/jarv.is)
[![Tor mirror status](https://img.shields.io/uptimerobot/status/m788172098-a4fcb769c8779f9a37a60775?color=7e4798&label=tor%20mirror&logo=tor-project&logoColor=white)](http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion/)
Personal website of [@jakejarvis](https://github.com/jakejarvis), created and deployed using the following:
- [Hugo Extended](https://github.com/gohugoio/hugo)
- [Netlify](https://www.netlify.com/)
- [Fathom Analytics](https://usefathom.com/ref/ZEYG0O) (referral link)
- 📈 My [stats are public](https://jarv.is/stats/), by the way!
- [...and more.](https://jarv.is/uses/)
Personal website of [@jakejarvis](https://github.com/jakejarvis), created and deployed using [Hugo](https://github.com/gohugoio/hugo), [Netlify](https://www.netlify.com/), [and more](https://jarv.is/uses/).
I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.is/issues/1) and [coding to-dos](https://github.com/jakejarvis/jarv.is/issues/11) as issues in this repo.

View File

@ -1,111 +0,0 @@
/*! Fathom - beautiful, simple website analytics. https://usefathom.com/ref/ZEYG0O */
window.fathom = (function () {
var siteId = "PPSQZUDY";
var trackerUrl = "https://jarv.is/api/count_view";
var honorDNT = false;
var auto = true;
var canonical = true;
var excludedDomains = [];
var allowedDomains = ["jarv.is"];
function encodeParameters(params) {
return (
"?" +
Object.keys(params)
.map(function (k) {
return encodeURIComponent(k) + "=" + encodeURIComponent(params[k]);
})
.join("&")
);
}
function trackingEnabled() {
var fathomIsBlocked = false;
try {
fathomIsBlocked = window.localStorage && window.localStorage.getItem("blockFathomTracking");
} catch (err) {}
var prerender = "visibilityState" in document && "prerender" === document.visibilityState;
var clientSideBot = /bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex/i.test(navigator.userAgent);
var isExcludedDomain = -1 < excludedDomains.indexOf(window.location.hostname); // eslint-disable-line compat/compat
var isAllowedDomain = !(0 < allowedDomains.length) || -1 < allowedDomains.indexOf(window.location.hostname); // eslint-disable-line compat/compat
return !(fathomIsBlocked || prerender || clientSideBot || honorDNT || isExcludedDomain) && isAllowedDomain;
}
return (
auto &&
setTimeout(function () {
window.fathom.trackPageview();
}),
{
send: function (params) {
var img;
if (trackingEnabled()) {
img = document.createElement("img");
img.setAttribute("alt", "");
img.setAttribute("aria-hidden", "true");
img.style.position = "absolute";
img.src = trackerUrl + encodeParameters(params);
img.addEventListener("load", function () {
img.parentNode.removeChild(img);
});
document.body.appendChild(img);
}
},
beacon: function (params) {
if (trackingEnabled()) {
navigator.sendBeacon(trackerUrl + encodeParameters(params));
}
},
trackPageview: function (params) {
if (params === undefined) params = {};
var hostname;
var location = window.location;
if (params.url === undefined) {
if (canonical && document.querySelector('link[rel="canonical"][href]')) {
(hostname = document.createElement("a")).href = document.querySelector('link[rel="canonical"][href]').href;
location = hostname;
}
} else {
(location = document.createElement("a")).href = params.url;
if ("" !== location.host) {
hostname = location.protocol + "//" + location.hostname;
}
}
this.send({
p: location.pathname + location.search || "/",
h: hostname,
r: params.referrer || (document.referrer.indexOf(hostname) < 0 ? document.referrer : ""),
sid: siteId,
});
},
trackGoal: function (code, cents) {
this.beacon({
gcode: code,
gval: cents,
});
},
/* blockTrackingForMe: function () {
if (window.localStorage) {
window.localStorage.setItem("blockFathomTracking", !0);
alert("You have blocked Fathom for yourself on this website");
} else {
alert("Your browser doesn't support localStorage.");
}
},
enableTrackingForMe: function () {
if (window.localStorage) {
window.localStorage.removeItem("blockFathomTracking");
alert("Fathom has been enabled for your device");
}
}, */
}
);
})();

View File

@ -29,19 +29,15 @@
# TECHNOLOGY
Hugo Extended
Hugo
Netlify
Fathom Analytics
GitHub Actions
...and much more: https://jarv.is/uses/
# VIEW SOURCE
https://github.com/jakejarvis/jarv.is
# ANALYTICS
https://jarv.is/stats/
# PRIVACY POLICY
https://jarv.is/privacy/

View File

@ -11,17 +11,7 @@ Okay, this is an easy one. 😉
## Analytics
This website uses [**Fathom Analytics**](https://usefathom.com/ref/ZEYG0O) to count pageviews **without collecting any personally identifiable information,** such as IP addresses, cookies, and browser fingerprints. Only the [following information](https://usefathom.com/data) is collected and recorded by them:
- URL visited
- Timestamp of visit
- Referrer URL (hostname and path)
- Language
- User agent (browser name and version)
- Screen and window sizes
- Duration of visit
**📈 Stats for this site are public! [View them here.](/stats/)**
This website uses a simple hit counter on each post to tally an aggregate number of pageviews. Individual views and identifying details are not stored. [The backend is open-source.](https://github.com/jakejarvis/jarv.is/blob/main/functions/hits.js)
## Hosting

View File

@ -1,23 +0,0 @@
---
title: "📈 Analytics"
description: "Public visitor stats for this website."
url: /stats
layout: etc
sitemap:
changefreq: never
css: |
div#content iframe {
display: block;
margin: 0 auto;
height: 600px;
width: 100%;
border: 0;
overflow: hidden;
}
---
This website uses [**Fathom Analytics**](https://usefathom.com/ref/ZEYG0O) to tally pageviews without tracking you — cookies and fingerprinting are never used. Refer to Fathom's [data policy](https://usefathom.com/data) for a complete list of information sent.
In that case, why not share them? 😊 Pageviews for the past month are graphed below and more information (top pages, referrers, etc.) can be found [on a publicly-accessible dashboard](https://app.usefathom.com/share/ppsqzudy/jarv.is).
{{< iframe src="https://app.usefathom.com/share/ppsqzudy/jarv.is#/?range=last_7_days&site=49569" title="Fathom Analytics dashboard" width="850" height="600" sandbox="allow-same-origin allow-scripts allow-popups" >}}

View File

@ -165,10 +165,7 @@ I've been making recent efforts to [de-Google](https://www.stallman.org/google.h
- [Read why.](/notes/dropping-dropbox/)
- ~~Google Docs~~ → [**Microsoft Office**](https://products.office.com/en-us/mac/microsoft-office-for-mac) (hey, it works 🤷)
- ~~Google Photos~~ → [**iCloud Photos**](https://www.icloud.com/photos/)
- ~~Google Analytics~~ → both of these are awesome, privacy-aware "visitor counters" rather than invasive trackers:
- [**Netlify Analytics**](https://www.netlify.com/products/analytics/) [(my review)](/notes/netlify-analytics-review/)
- [**Fathom Analytics**](https://usefathom.com/) [(referral link)](https://usefathom.com/ref/ZEYG0O)
- 📈 This website's [stats are public](/stats/), by the way!
- ~~Google Analytics~~ → [**Netlify Analytics**](https://www.netlify.com/products/analytics/) [(my review)](/notes/netlify-analytics-review/)
- ~~Google Public DNS~~ → [**Cloudflare's 1.1.1.1**](https://1.1.1.1/dns/) on my home network.
- ~~GoDaddy~~ → ~~Google Domains~~ → [**Cloudflare Registrar**](https://www.cloudflare.com/products/registrar/) (and [**ISNIC**](https://isnic.is/en/) of course 🇮🇸)

View File

@ -12,7 +12,6 @@
{{ block "main" . }}{{ end }}
</main>
{{ partial "page/footer" . }}
{{ partialCached "scripts/set_theme" . -}}
{{ partialCached "scripts/_bundle" . -}}
{{ partial "scripts/shortcodes" . -}}
</body>

View File

@ -1,15 +1,10 @@
{{/* only parse and append analytics script on production site */}}
{{- $includeProdScripts := eq hugo.Environment "production" -}}
{{- $counter := resources.Get "js/counter.js" -}}
{{- $twemoji := resources.Get "js/vendor/twemoji.js" -}}
{{- $bundle := slice $counter $twemoji -}}
{{- if $includeProdScripts -}}
{{- $fathom := resources.Get "js/fathom.js" -}}
{{- $bundle = $bundle | append $fathom -}}
{{- end -}}
{{- $js := $bundle | resources.Concat "/js/app.js" -}}
<!-- inline the dark mode script to avoid a blinding flash of white background on loads -->
<script>(function(d){var u=d.document,f=u.body.classList,e=localStorage,c="dark_mode_pref",t=e.getItem(c),a="dark",n="light",r="{{ .Site.Params.Theme.defaultTheme | safeJS }}",o=u.querySelector(".dark-mode-toggle"),i=r===a,b=function(d){f.remove(a,n);f.add(d);i=d===a};t===a&&b(a);t===n&&b(n);if(!t){var s=function(d){return"(prefers-color-scheme: "+d+")"};d.matchMedia(s(a)).matches?b(a):d.matchMedia(s(n)).matches?b(n):b(r);d.matchMedia(s(a)).addListener((function(d){d.matches&&b(a)}));d.matchMedia(s(n)).addListener((function(d){d.matches&&b(n)}))}if(o){o.style.display="block";o.addEventListener("click",(function(){if(i){b(n);e.setItem(c,n)}else{b(a);e.setItem(c,a)}}),!0)}})(window)</script>
<script async defer src="{{ $js.Permalink }}"></script>

View File

@ -1 +0,0 @@
<script>(function(d){var u=d.document,f=u.body.classList,e=localStorage,c="dark_mode_pref",t=e.getItem(c),a="dark",n="light",r="{{ .Site.Params.Theme.defaultTheme | safeJS }}",o=u.querySelector(".dark-mode-toggle"),i=r===a,b=function(d){f.remove(a,n);f.add(d);i=d===a};t===a&&b(a);t===n&&b(n);if(!t){var s=function(d){return"(prefers-color-scheme: "+d+")"};d.matchMedia(s(a)).matches?b(a):d.matchMedia(s(n)).matches?b(n):b(r);d.matchMedia(s(a)).addListener((function(d){d.matches&&b(a)}));d.matchMedia(s(n)).addListener((function(d){d.matches&&b(n)}))}if(o){o.style.display="block";o.addEventListener("click",(function(){if(i){b(n);e.setItem(c,n)}else{b(a);e.setItem(c,a)}}),!0)}})(window)</script>