Indie Analytics

By Ilarion Ioannidis

0+ active installationsVersion 1.10.1

Indie Analytics helps you easily integrate privacy-focused, independent analytics tools into your WordPress site.

Description

Indie Analytics helps you easily integrate privacy-focused, independent analytics tools into your WordPress site.

Supported Analytics Providers:

  • Umami – Privacy-focused, cookie-free alternative to Google Analytics
  • Plausible – Simple, privacy-friendly Google Analytics alternative
  • Swetrix – Privacy-focused web analytics service
  • Matomo – Open-source analytics platform
  • Fathom – Simple analytics for bloggers & businesses
  • Simple Analytics – Privacy-first analytics, no cookies, GDPR/CCPA compliant
  • GoatCounter – Open source, privacy-friendly web analytics (free hosted or self-hosted)
  • Pirsch – Privacy-friendly, cookie-free analytics from Germany (GDPR compliant)
  • Cabin – Privacy-first, carbon-aware web analytics (no cookies, auto-detects domain)
  • Tinylytics – Minimal, privacy-focused analytics with hits, kudos, and uptime monitoring
  • Counter.dev – Simple, open-source, privacy-friendly web analytics (free, donation-supported)

Features

  • Easy integration with multiple indie analytics providers
  • Enable more than one provider at the same time — each runs independently with its own credentials
  • Simple admin interface for configuration
  • Detailed setup instructions for each provider
  • Exclude any combination of WordPress user roles (administrators, editors, authors, custom roles, etc.) from tracking
  • Exclude individual posts/pages from tracking with a one-click meta-box checkbox
  • Exclude URL paths (with * wildcards) globally, e.g. for staging areas or legal pages
  • Fire custom events to every enabled provider with a single PHP helper or shortcode
  • Auto-track outbound link clicks, file downloads, and 404 pages (opt-in per option)
  • Support for custom domains
  • Fast and lightweight

Configuration

  1. Tick the box on any provider card to enable it (you can enable more than one — each runs independently)
  2. For each enabled provider:
    • Enter your Site ID / Tracking ID (or leave blank for providers that auto-detect the domain)
    • Enter the Tracking Script URL (a default is pre-filled for most providers)
    • Optionally, enter a custom domain if you proxy or self-host the script
  3. Tick any user roles you want to exclude from tracking (administrators, editors, authors, contributors, subscribers, or any custom role)
  4. Optionally, enter URL path patterns (one per line) to exclude entire sections of the site — * is a wildcard, e.g. /staging/* or /privacy-policy
  5. Save your settings
  6. To exclude a specific post or page, open it in the editor and tick “Exclude this entry from analytics tracking” in the Analytics Tracking meta box

Provider Setup Instructions

Umami

  1. Create an account on Umami or set up your self-hosted instance
  2. Create a website in your Umami dashboard
  3. Copy the Website ID and Tracking Script URL from your Umami dashboard
  4. Paste these values into the corresponding fields in the plugin settings

Plausible

  1. Create an account on Plausible
  2. Add your website domain in the Plausible dashboard
  3. Your Site ID is your domain name (e.g., example.com)
  4. The Tracking Script URL is https://plausible.io/js/plausible.js
  5. If you use a custom domain for Plausible, enter it in the Custom Domain field

Swetrix

  1. Create an account on Swetrix
  2. Create a new project in the Swetrix dashboard
  3. Copy the Project ID from the installation instructions
  4. The Tracking Script URL is https://swetrix.org/swetrix.js

Matomo

  1. Set up Matomo on your server or create an account on Matomo Cloud
  2. Create a new website in Matomo
  3. Copy the Site ID from the tracking code
  4. The Tracking Script URL is the path to your matomo.js file (e.g., https://example.org/matomo/matomo.js)

Fathom

  1. Create an account on Fathom
  2. Add your website in the Fathom dashboard
  3. Copy the Site ID from the tracking code snippet
  4. The Tracking Script URL is https://cdn.usefathom.com/script.js
  5. If you use a custom domain for Fathom, enter it in the Custom Domain field

Simple Analytics

  1. Create an account on Simple Analytics
  2. Add your website in the Simple Analytics dashboard
  3. Leave the Site ID field blank (Simple Analytics auto-detects your domain), or set it to override the auto-detected hostname (useful for staging/proxied installs)
  4. The Tracking Script URL is https://scripts.simpleanalyticscdn.com/latest.js
  5. If you use a custom domain for Simple Analytics, enter the full script URL in the Custom Domain field

GoatCounter

  1. Create a free account on GoatCounter or set up a self-hosted instance
  2. Your Site ID is your GoatCounter subdomain code (e.g., mysite for mysite.goatcounter.com). For self-hosted installs, enter the full https:// counting endpoint URL (e.g., https://stats.example.com/count) instead
  3. The Tracking Script URL is https://gc.zgo.at/count.js
  4. If you self-host the count.js script, enter the full URL in the Custom Domain field; it will override the Tracking Script URL

Pirsch

  1. Create an account on Pirsch
  2. Add your website domain in the Pirsch dashboard
  3. Copy the Identification Code from the website settings — this is your Site ID
  4. The Tracking Script URL is https://api.pirsch.io/pa.js (swap in https://api.pirsch.io/pa-sd.js to enable session-duration tracking)

Cabin

  1. Create an account on Cabin
  2. Add your website in the Cabin dashboard
  3. Cabin auto-detects your domain — leave the Site ID field blank
  4. The Tracking Script URL is https://scripts.withcabin.com/hello.js
  5. If you proxy Cabin via a custom subdomain, enter the full script URL in the Custom Domain field; it will override the Tracking Script URL

Tinylytics

  1. Create an account on Tinylytics
  2. Add your website in the Tinylytics dashboard to generate a unique Site Code
  3. Copy the Site Code from your embed snippet (the part between /embed/ and .js in the URL) — this is your Site ID
  4. The Tracking Script URL is https://tinylytics.app/embed/ (your Site Code is appended automatically). To proxy Tinylytics, paste the full script URL (ending in .js) into the Custom Domain field and it will be used as-is.

Counter.dev

  1. Create a free account on Counter.dev
  2. Your Site ID is the value used for data-id in the embed snippet (your Counter.dev username/identifier)
  3. The Tracking Script URL is https://cdn.counter.dev/script.js
  4. Set the UTC Offset: leave at 0 for UTC (the default Counter.dev snippet behavior), enter a custom value in hours (e.g. -5 for EST, 5.5 for IST), or choose “Detect from visitor’s browser” to insert a tiny inline script that reads each visitor’s offset at load time
  5. If you proxy Counter.dev via a custom URL, enter the full script URL in the Custom Domain field; it will override the Tracking Script URL

Custom Event Tracking

The plugin can fire custom events to every enabled provider without you having to know each provider’s JavaScript API. There are three ways to trigger an event:

1. PHP helper (template tag)

Call from a theme template or another plugin to fire an event on page load:

<?php lostendfound_indie_analytics_track_event( 'signup-completed' ); ?>

The helper emits a hidden <span data-iaevent="..."> that the front-end dispatcher scans on init and fires through every enabled provider’s adapter. It works from anywhere — header.php, the_content, sidebars, footer — and is safe under strict Content-Security-Policy (script-src 'self') because it never adds an inline <script> tag. In AJAX/REST/cron/WP-CLI contexts the helper returns the markup string but skips echoing it so a JSON response body isn’t corrupted; pass $echo = false to capture markup yourself in any context.

Pass an associative array of properties as the second argument; the dispatcher maps the keys to each provider’s native shape (Plausible reads them as props, Umami / Simple Analytics / Cabin forward them through, Swetrix nests them under meta, Pirsch nests them under options.meta, Fathom keeps _value/_site_id). Matomo reads optional category (defaults to event) and uses url/path as the event label.

<?php lostendfound_indie_analytics_track_event( 'add-to-cart', array( 'category' => 'commerce', 'product' => 'shirt' ) ); ?>

2. Shortcode

Wrap any button, link, or inline element to fire an event when it (or anything inside it) is clicked:

[indie-analytics-event name="cta-clicked"]<a href="/pricing/">See pricing</a>[/indie-analytics-event]

The shortcode renders an inline <span> with a data-iaevent attribute that the dispatcher’s delegated click handler picks up — no inline onclick, so it works on CSP-locked sites. The wrapper auto-promotes to <div> if the inner HTML contains block-level tags (<p>, <h2>, <div>, <ul>, …) so the HTML5 parser doesn’t auto-close the <span> and orphan the data attribute. Force <div> explicitly by passing block="true".

3. Auto-track options

Tick any of these in the Custom Event Tracking section of the settings:

  • Track outbound link clicks — fires Outbound Link events with {url} properties on any anchor whose host differs from the current site (apex/www. pairs match as same-site). Both left-click and middle-click (open-in-new-tab) are caught.
  • Track file downloads — fires Download events with {url} properties on anchors whose URL pathname ends in one of the listed extensions (PDF, ZIP, DOC/X, XLS/X, MP3/4, etc. by default — paste your own comma-, space-, semicolon-, or pipe-separated list to override).
  • Track 404 pages — fires a 404 event with {path} properties when WordPress serves a not-found response.

Programmatic JS API

The dispatcher also exposes a global for inline scripts, custom builds, or third-party integrations:

window.indieAnalytics.track( 'event-name', { /* optional properties */ } );

Provider notes

  • Plausible requires the script variant that exposes the plausible() function for custom events (https://plausible.io/js/script.tagged-events.js, script.manual.js, etc.). The default plausible.js URL does not — change the Tracking Script URL in the provider card if you want custom events.
  • Tinylytics and Counter.dev do not expose a custom-event JS API; their adapters are no-ops, so events fire normally for every other enabled provider while pageview tracking on those two keeps working.

License

This plugin is licensed under the GPL v2 or later.

Credits

Indie Analytics was created to help website owners easily implement privacy-focused analytics tools as alternatives to Google Analytics.

Installation

  1. Download the plugin zip file or clone the repository
  2. Upload the plugin files to the /wp-content/plugins/indie-analytics directory
  3. Activate the plugin through the ‘Plugins’ screen in WordPress
  4. Navigate to ‘Indie Analytics’ in your admin menu to configure the plugin

FAQ

Does this plugin send any data to third parties?

No. This plugin simply helps you set up your chosen third-party analytics service. No data is sent to the plugin author or any other parties.

Is this plugin GDPR compliant?

This plugin itself doesn’t collect any data. The compliance status depends on the analytics provider you choose to use. Many of the supported providers (like Plausible and Fathom) are designed to be privacy-friendly and GDPR compliant.

Changelog

1.10.1

  • Tested with WordPress 7.0
  • Fixed a fatal error when saving a post or page with the “Analytics Tracking” meta box (the autosave check called a function that doesn’t exist in WordPress core)

1.10.0

  • Added an opt-in per-provider “Enable noscript fallback” for Matomo, Simple Analytics and GoatCounter: a <noscript> image pixel in the footer so visitors without JavaScript are still counted. Role, URL and per-post exclusions apply to the pixel too.

1.9.0

  • Added Debug Mode for administrators: an HTML comment in the page source, a browser console message and an admin-bar indicator showing which providers are tracking (also when you are excluded from tracking)
  • Added the lostendfound_indie_analytics_debug_mode filter to force Debug Mode on in staging or development

1.8.0

  • Added a per-provider Script Loading Strategy setting (Synchronous, Async, Defer, Async + Defer, Module). Each provider keeps its previous behavior as the default, so existing installs are unaffected until the dropdown is changed.
  • Swetrix omits the “Async” option from its dropdown because its inline init runs inside a DOMContentLoaded handler that would race an async-loaded main script.
  • Counter.dev’s “Detect from visitor’s browser” mode now threads the chosen strategy into the dynamically-built <script> element.

1.7.0

  • Added custom event tracking that routes a single lostendfound_indie_analytics_track_event() PHP helper (or the new [indie-analytics-event] shortcode) to every enabled provider’s native event API
  • Added auto-track settings for outbound link clicks, file downloads (with a configurable extension allow-list), and 404 pages
  • Added a window.indieAnalytics.track() JS global for inline scripts and third-party integrations
  • Added Counter.dev as a supported provider (simple, open-source, privacy-friendly analytics)
  • Counter.dev card includes a UTC Offset selector: fixed UTC (0), a custom hour value (e.g. -5, 5.5), or visitor-detected via a tiny inline script

1.6.0

  • Added per-post/page exclusion: a new “Analytics Tracking” meta box on the post and page editor lets you skip tracking on individual entries without touching global settings
  • Added global URL exclusion patterns: enter glob-style paths (e.g. /staging/*, /privacy-policy) in settings to suppress tracking across whole sections of the site

1.5.0

  • Added support for enabling multiple analytics providers at the same time (e.g. Plausible alongside Matomo); each provider has its own enable toggle and configuration card
  • Added Tinylytics as a supported provider (minimal, privacy-focused analytics; Site Code embedded in the script URL)
  • Sites upgrading from 1.4.x have their existing single-provider configuration migrated to the new storage on first wp-admin load

1.4.0

  • Replaced the single “Exclude Admins” checkbox with per-role exclusion: tick any combination of WordPress roles (including custom roles) to keep their logged-in visits out of analytics
  • Sites upgrading from 1.3.x that had “Exclude Admins” enabled keep excluding administrators until the settings form is saved with new choices

1.3.0

  • Added Pirsch as a supported provider (privacy-friendly, cookie-free analytics from Germany)
  • Added Cabin as a supported provider (privacy-first, carbon-aware analytics; auto-detects domain, no site ID needed)

1.2.0

  • Added GoatCounter as a supported provider (hosted via subdomain code or self-hosted via full endpoint URL)

1.1.0

  • Added Simple Analytics as a supported provider (auto-detects domain; optional Site ID maps to data-hostname)
  • Custom Domain field now sanitized as a URL
  • Tracking now works when only Custom Domain is provided (no Tracking Script URL)
  • Admin and Public layers now share a single provider registry (data-driven requires_site_id flag)
  • Site ID label updates dynamically per provider

1.0.0

  • Initial release