mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
* Align Postgres version on 18.6 * Document production tablebase path and permissions * Add cookieless Matomo analytics with opt-out (#131)
This commit is contained in:
@@ -296,4 +296,48 @@ defmodule ChesstrainerWeb.Layouts do
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders the Matomo configuration for anonymous public pages.
|
||||
|
||||
The actual tracker is initialised by `assets/js/analytics.js`. Signed-in
|
||||
visitors never get the config element, so account and admin pages are not
|
||||
tracked.
|
||||
"""
|
||||
attr :current_scope, :map, default: nil
|
||||
|
||||
def analytics(assigns) do
|
||||
config = Application.get_env(:chesstrainer, :matomo, [])
|
||||
url = normalize_matomo_url(config[:url])
|
||||
site_id = config[:site_id]
|
||||
user = Map.get(assigns, :current_scope) && assigns.current_scope.user
|
||||
|
||||
assigns =
|
||||
assign(assigns,
|
||||
matomo_url: url,
|
||||
matomo_site_id: site_id && to_string(site_id),
|
||||
analytics_enabled:
|
||||
is_binary(url) and url != "" and site_id not in [nil, ""] and is_nil(user)
|
||||
)
|
||||
|
||||
~H"""
|
||||
<div
|
||||
:if={@analytics_enabled}
|
||||
id="matomo-config"
|
||||
data-url={@matomo_url}
|
||||
data-site-id={@matomo_site_id}
|
||||
hidden
|
||||
>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
||||
defp normalize_matomo_url(url) when is_binary(url) do
|
||||
case String.trim(url) do
|
||||
"" -> nil
|
||||
url -> String.trim_trailing(url, "/") <> "/"
|
||||
end
|
||||
end
|
||||
|
||||
defp normalize_matomo_url(_url), do: nil
|
||||
end
|
||||
|
||||
@@ -76,5 +76,6 @@
|
||||
<Layouts.navbar current_scope={@current_scope} />
|
||||
{@inner_content}
|
||||
<Layouts.footer />
|
||||
<Layouts.analytics current_scope={@current_scope} />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<main>
|
||||
<article class="legal">
|
||||
<h1>Privacy Policy</h1>
|
||||
<p class="legal-meta">Last updated: 6 November 2026</p>
|
||||
<p class="legal-meta">Last updated: 10 November 2026</p>
|
||||
|
||||
<p>
|
||||
{Branding.name()} is an endgame training site. This policy explains what
|
||||
@@ -37,6 +37,14 @@
|
||||
(IP address, browser, timestamps) for security and troubleshooting.
|
||||
These logs are rotated regularly.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Usage data.</strong>
|
||||
On public pages and the guest trainer, we use a self-hosted Matomo
|
||||
instance to understand aggregate usage. Matomo is configured without
|
||||
cookies, with IP anonymisation, and to respect Do Not Track. We do not
|
||||
use user IDs, track signed-in account pages, or share this data with
|
||||
third parties.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Messages you send us.</strong>
|
||||
If you contact us, we keep the message and our reply for as long as
|
||||
@@ -53,19 +61,62 @@
|
||||
<li>a session cookie that keeps you signed in;</li>
|
||||
<li>a CSRF token that protects forms from cross-site requests;</li>
|
||||
<li>a colour-mode preference stored in your browser.</li>
|
||||
<li>
|
||||
an analytics opt-out preference stored in your browser's local storage,
|
||||
if you choose to opt out.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
We do not use advertising cookies, third-party analytics, or cross-site
|
||||
tracking. You can clear these entries at any time in your browser
|
||||
settings; doing so will sign you out and reset your colour mode.
|
||||
tracking. Our analytics is self-hosted Matomo and is configured without
|
||||
cookies. You can clear these entries at any time in your browser settings;
|
||||
doing so will sign you out, reset your colour mode, and reset your
|
||||
analytics preference.
|
||||
</p>
|
||||
|
||||
<h2>Analytics</h2>
|
||||
<p>
|
||||
We use a self-hosted Matomo instance at
|
||||
<a href="https://analytics.owenrees.eu/">analytics.owenrees.eu</a>
|
||||
to understand aggregate use of the public site and guest trainer. It is
|
||||
configured without cookies, with IP anonymisation, and to respect Do Not
|
||||
Track. We do not use user IDs, track signed-in account pages, or share
|
||||
this data with third parties.
|
||||
</p>
|
||||
<p>
|
||||
Raw analytics data is retained for up to 180 days. We process it on the
|
||||
basis of our legitimate interests in improving the service. You can
|
||||
object at any time using the control below or by emailing <a href={"mailto:" <> Branding.support_email()}>{Branding.support_email()}</a>.
|
||||
</p>
|
||||
<p id="analytics-status">Analytics is currently on in this browser.</p>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<button
|
||||
id="analytics-opt-out"
|
||||
type="button"
|
||||
class="inline-flex items-center justify-center rounded-md border border-base-300 bg-base-100 px-4 py-2 text-sm font-semibold text-base-content hover:bg-base-200"
|
||||
>
|
||||
Opt out of analytics
|
||||
</button>
|
||||
<button
|
||||
id="analytics-opt-in"
|
||||
type="button"
|
||||
hidden
|
||||
class="inline-flex items-center justify-center rounded-md border border-base-300 bg-base-100 px-4 py-2 text-sm font-semibold text-base-content hover:bg-base-200"
|
||||
>
|
||||
Opt back in
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h2>How we use your information</h2>
|
||||
<ul>
|
||||
<li>To create and secure your account and sign you in.</li>
|
||||
<li>To run the trainer and remember your progress.</li>
|
||||
<li>To send service emails, such as confirmation and password reset links.</li>
|
||||
<li>To send occasional endgame tips and site news, if you opted in.</li>
|
||||
<li>
|
||||
To understand aggregate use of the public site and guest trainer, and
|
||||
improve the service.
|
||||
</li>
|
||||
<li>To keep the site available, prevent abuse, and fix faults.</li>
|
||||
<li>To respond when you ask for help.</li>
|
||||
</ul>
|
||||
@@ -102,8 +153,10 @@
|
||||
We do not sell your personal information. We share it only with providers
|
||||
who help us run the site — for example hosting, database, and email
|
||||
delivery providers — and only as far as they need it to perform that work.
|
||||
We may also disclose information where the law requires it or to protect
|
||||
the rights and safety of our users.
|
||||
Self-hosted Matomo analytics is operated by us on infrastructure we
|
||||
control; we do not share that data with third parties. We may also
|
||||
disclose information where the law requires it or to protect the rights
|
||||
and safety of our users.
|
||||
</p>
|
||||
|
||||
<h2>Retention</h2>
|
||||
@@ -111,16 +164,18 @@
|
||||
We keep account and training data while your account is open. If you
|
||||
delete your account, we remove your personal information within a
|
||||
reasonable period, except where we must keep records for legal, security,
|
||||
or accounting reasons.
|
||||
or accounting reasons. We retain raw analytics data for up to 180 days.
|
||||
</p>
|
||||
|
||||
<h2>Your rights</h2>
|
||||
<p>
|
||||
Depending on where you live, you may have the right to access, correct,
|
||||
delete, restrict, or export your personal information, and to object to
|
||||
some uses of it. To make a request, contact us using the address below. If
|
||||
you are in the UK or EU and are unhappy with our response, you can complain
|
||||
to your local data protection authority.
|
||||
some uses of it. You can object to analytics processing at any time using
|
||||
the control on this page or by contacting us. To make a request, contact
|
||||
us using the address below. If you are in the UK or EU and are unhappy
|
||||
with our response, you can complain to your local data protection
|
||||
authority.
|
||||
</p>
|
||||
|
||||
<h2>Children</h2>
|
||||
|
||||
Reference in New Issue
Block a user