1
0
mirror of https://github.com/privacyguides/privacyguides.org.git synced 2024-07-15 23:13:48 +00:00

fix: Remove device detection JS (#2576)

Signed-off-by: Daniel Gray <dngray@privacyguides.org>
This commit is contained in:
Jonah Aragon 2024-05-26 08:06:42 +00:00 committed by Daniel Gray
parent 87aa1586f3
commit 32e65cf3e8
No known key found for this signature in database
GPG Key ID: 41911F722B0F9AE3
6 changed files with 7 additions and 113 deletions

View File

@ -2,13 +2,14 @@
title: Traffic Statistics
---
<!-- markdownlint-disable MD051 -->
We self-host [Umami](https://umami.is) to create a nice visualization of our traffic statistics, which are public at the link below. With this process:
We self-host [Umami](https://umami.is) to create a nice visualization of our traffic statistics, which are public at the link below.
[View Statistics](https://stats.privacyguides.net/share/nVWjyd2QfgOPBhMF/www.privacyguides.org){ .md-button .md-button--primary }
With this process:
- Your information is never shared with a third-party, it stays on servers we control
- Your personal data is never saved, we only collect data in aggregate
- No client-side JavaScript is required
- No client-side JavaScript is used
Because of these facts, keep in mind our statistics may be inaccurate. It is a useful tool to compare different dates with each other and analyze overall trends, but the actual numbers may be far off from reality. They're *precise* statistics, but not *accurate* statistics.
[View Statistics](https://stats.privacyguides.net/share/nVWjyd2QfgOPBhMF/www.privacyguides.org){ .md-button .md-button--primary }
[Opt-Out](#__consent){ .md-button }
Because of these facts, keep in mind our statistics may be inaccurate. It is a useful tool to compare different dates with each other and analyze overall trends, but the actual numbers may be far off from reality. In other words they're *precise* statistics, but not *accurate* statistics.

View File

@ -1,14 +1,9 @@
ANALYTICS_CONSENT_BODY="We collect anonymous statistics about your visits to help us improve the site. We do not track you across other websites. If you disable this, we will not know when you have visited our site. We will save a single cookie in your browser to remember your preference."
ANALYTICS_CONSENT_TITLE="Contribute anonymous statistics"
ANALYTICS_COOKIE_GITHUB="GitHub API"
ANALYTICS_COOKIE_UMAMI="Self-Hosted Analytics"
ANALYTICS_FEEDBACK_NEGATIVE_NAME="This page could be improved"
ANALYTICS_FEEDBACK_NEGATIVE_NOTE='Thanks for your feedback! If you want to let us know more, please leave a post on our <a href="https://discuss.privacyguides.net/c/site-development/7" target="_blank" rel="noopener">forum</a>.'
ANALYTICS_FEEDBACK_POSITIVE_NAME="This page was helpful"
ANALYTICS_FEEDBACK_POSITIVE_NOTE="Thanks for your feedback!"
ANALYTICS_FEEDBACK_TITLE="Was this page helpful?"
DESCRIPTION_HOMEPAGE="A socially motivated website which provides information about protecting your online data privacy and security."
FOOTER_ANALYTICS="Anonymous statistics preferences."
FOOTER_COPYRIGHT_AUTHOR="Privacy Guides and contributors."
FOOTER_INTRO="<b>Privacy Guides</b> is a non-profit, socially motivated website that provides information for protecting your data security and privacy."
FOOTER_NOTE="We do not make money from recommending certain products, and we do not use affiliate links."

View File

@ -56,7 +56,6 @@ extra:
- fontawesome/brands/creative-commons
- fontawesome/brands/creative-commons-by
- fontawesome/brands/creative-commons-sa
analytics: !ENV [FOOTER_ANALYTICS, "Anonymous statistics preferences."]
homepage:
description:
!ENV [
@ -235,24 +234,6 @@ extra:
data: 0
note:
!ENV [ANALYTICS_FEEDBACK_NEGATIVE_NOTE, "Thanks for your feedback!"]
consent:
title: !ENV [ANALYTICS_CONSENT_TITLE, "Contribute anonymous statistics"]
description:
!ENV [
ANALYTICS_CONSENT_BODY,
"We use cookies to collect anonymous usage statistics. You can opt out if you wish.",
]
cookies:
analytics:
name: !ENV [ANALYTICS_COOKIE_UMAMI, "Self-Hosted Analytics"]
checked: true
github:
name: !ENV [ANALYTICS_COOKIE_GITHUB, "GitHub API"]
checked: true
actions:
- reject
- accept
- manage
repo_url:
!ENV [BUILD_REPO_URL, "https://github.com/privacyguides/privacyguides.org"]
@ -303,7 +284,6 @@ extra_css:
- assets/stylesheets/extra.css?v=2
extra_javascript:
- assets/javascripts/randomize-element.js?v=1
- assets/javascripts/resolution.js?v=1
- assets/javascripts/feedback.js?v=1
watch:

View File

@ -1,78 +0,0 @@
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
var consent = __md_get("__consent")
if (!consent) {
__md_set("__consent", {"analytics":true,"github":true});
if (getCookie('resolution') == '') {
const resolution = `${window.screen.width}x${window.screen.height}`;
setCookie('resolution', resolution, 30);
}
}
if (consent && consent.analytics) {
if (getCookie('resolution') == '') {
const resolution = `${window.screen.width}x${window.screen.height}`;
setCookie('resolution', resolution, 30);
}
setCookie('umami', 'true', 0);
} else {
setCookie('umami', 'false', 365);
setCookie('resolution', "0x0", 0);
}
var consent = __md_get("__consent")
if (consent) {
for (var input of document.forms.consent.elements)
if (input.name)
input.checked = consent[input.name] || false
/* Show consent with a small delay, but not if browsing locally */
} else if (location.protocol !== "file:") {
setTimeout(function() {
var el = document.querySelector("[data-md-component=consent]")
el.hidden = false
}, 250)
}
/* Intercept submission of consent form */
var form = document.forms.consent
for (var action of ["submit", "reset"])
form.addEventListener(action, function(ev) {
ev.preventDefault()
/* Reject all cookies */
if (ev.type === "reset")
for (var input of document.forms.consent.elements)
if (input.name)
input.checked = false
/* Grab and serialize form data */
__md_set("__consent", Object.fromEntries(
Array.from(new FormData(form).keys())
.map(function(key) { return [key, true] })
))
/* Remove anchor to omit consent from reappearing and reload */
location.hash = '';
location.reload()
})

View File

@ -35,9 +35,6 @@
{% endfor %}
</a>
{{ copyright.copyright.date }} {{ copyright.copyright.author }}
<a href='#__consent'>
{{ copyright.analytics }}
</a>
</div>
{% endif %}
</div>

View File

@ -1 +0,0 @@
<!-- moved to assets/javascripts/resolution.js -->