Remove Plausible analytics (migrated to OpenPanel)

This commit is contained in:
victormanuel.caverogracia 2026-07-26 20:39:26 +02:00
parent f0ecb0d078
commit 28a1f6aef2
2 changed files with 12 additions and 15 deletions

View file

@ -190,8 +190,6 @@
</script>
<!-- Analytics -->
<script defer data-domain="openshorts.app" src="https://analytics.fotoexamen.com/js/script.js"></script>
<script>window.plausible = window.plausible || function () { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<!-- OpenPanel analytics (self-hosted) -->
<script>
window.op = window.op || function () { var n = []; return new Proxy(function () { arguments.length && n.push([].slice.call(arguments)); }, { get: function (t, r) { return "q" === r ? n : function () { n.push([r].concat([].slice.call(arguments))); }; }, has: function (t, r) { return "q" === r; } }); }();

View file

@ -1,20 +1,19 @@
// Lightweight Plausible custom-event helper.
// Lightweight custom-event helper (OpenPanel).
//
// The hosted openshorts.app build loads the Plausible script (see index.html),
// which exposes `window.plausible`. Self-hosted builds, ad-blockers or offline
// dev simply won't have it — every call here is a safe no-op in that case, so
// analytics can never break the app or leak into the open-source experience.
// The hosted openshorts.app build loads OpenPanel (see index.html), which
// exposes `window.op`. Self-hosted builds, ad-blockers or offline dev simply
// won't have it — every call here is a safe no-op in that case, so analytics
// can never break the app or leak into the open-source experience.
//
// This targets a Plausible Community Edition instance, which has NO revenue
// goals (that's a Cloud-only feature) — so prices ride along as ordinary props
// (e.g. value_usd) that CE can break a goal down by. Goals to create (by name):
// - Signup (custom event) — account created / signed in
// - CheckoutStarted (custom event) — redirected to Stripe Checkout
// - Subscribed (custom event) — plan activated after checkout
// Events (name — meaning):
// - Signup — account created / signed in
// - CheckoutStarted — redirected to Stripe Checkout
// - Subscribed — plan activated after checkout
// Prices ride along as ordinary props (e.g. value_usd) for breakdowns.
export function track(event, options) {
try {
if (typeof window !== 'undefined' && typeof window.plausible === 'function') {
window.plausible(event, options);
if (typeof window !== 'undefined' && typeof window.op === 'function') {
window.op('track', event, (options && options.props) || {});
}
} catch (_) {
/* analytics must never throw into the app */