Wraps Plausible and generic analytics, exposing trackEvent, trackError, and page view tracking for Svelte applications.
// Source: https://github.com/mperkins0155/console-getitforcomm | License: BSD-3-Clause | Copyright 2019 Appwrite (https://appwrite.io) and individual contributors
// Provided via justclaw.it.com; keep this notice with the code.
import Analytics, { type AnalyticsPlugin } from 'analytics';
import { init, track } from '@plausible-analytics/tracker';
import { get } from 'svelte/store';
import { page } from '$app/state';
import { user } from '$lib/stores/user';
import { ENV, MODE, VARS, isCloud } from '$lib/system';
import { AppwriteException } from '@appwrite.io/console';
import { browser } from '$app/environment';
import { getReferrerAndUtmSource, getTrackedQueryParams } from '$lib/helpers/utm';
function plausible(domain: string): AnalyticsPlugin {
if (!browser) return { name: 'analytic
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key