| 开发者 | TinkerCoded |
|---|---|
| 更新时间 | 2026年5月10日 23:38 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
wp_enqueue_script() with configurable script URL, debounce, and session replay.rybbit.identify().post_view, page_view, archive_view, search_view, etc.) with WordPress metadata as event properties.tinker-stats-for-rybbit folder to /wp-content/plugins/Rybbit is an open-source, privacy-friendly web analytics platform — a modern alternative to Google Analytics. It supports self-hosting and tracks visitors without cookies.
Yes, if you enable it. The Tracking section lets you inject the Rybbit tracking script on your frontend with one toggle. You can also configure role exclusion, user identification, and custom events. If tracking is disabled, the plugin only reads existing analytics data from your Rybbit instance via its API.
Every hour, the plugin fetches lifetime cumulative metrics from Rybbit and saves them as post meta (_tinker_stats_views). This makes view counts available to themes, page builders, and sorting queries.
The stored value is a running total from the date your Rybbit site was first created — it doesn't reset at month boundaries. The plugin auto-detects this start date from your Rybbit instance the first time it syncs; if the connection details change (different Rybbit instance or different Site ID), the start date is re-detected on the next sync.
Yes. Go to Tinker Stats → Settings and click "Sync Postmeta Now" in the Tools section.
Yes. The API key is encrypted using AES-256-CBC with keys derived from your WordPress salts before being stored in the database.
The most common cause is ad blockers (uBlock Origin, Brave's built-in blocker, etc.) blocking the Rybbit tracking script. Even though Rybbit is privacy-friendly and cookieless, some blocklist maintainers block all analytics scripts indiscriminately. Estimates put the impact between 6% and 60% of visitors depending on your audience's technical level.
A common gotcha: ad blocker filter lists also match on URL keywords. Words like "stats", "analytics", "tracking", "metrics", or "telemetry" anywhere in the script URL will trigger blockers regardless of the actual script content. If your Script URL contains any of these, expect blocking even before the request reaches your server.
The fix is to proxy the tracking script through your own domain so it loads as a first-party request. The plugin includes a built-in proxy that handles this for you: go to Tinker Stats → Settings → Tracking and enable the "Bypass Ad Blockers" toggle. The plugin will fetch and cache the Rybbit script, generate a randomized first-party path, and forward all tracking events through your own domain. No webserver config required.
If you'd rather configure the proxy yourself at the webserver or CDN level, see Rybbit's proxy guide and enter the relative path (e.g. /api/script.js) in the Script URL field.
To verify your tracking is actually firing, open your Rybbit dashboard, go to Site Settings → Tracking Script, and click "Verify Installation". Rybbit will check whether the script is loading on your site and confirm the connection.
Other less common causes: tracking is disabled in the plugin settings, your role is in the Exclude Roles list, or the tracking ID isn't populated yet.
When enabled, the plugin generates a randomized 8-character hex prefix (e.g. k3p9m2qr) and serves the Rybbit tracking script and tracking endpoints through https://yoursite.com/[hash]/.... Static script files are cached locally and refreshed daily; tracking POSTs are forwarded to your Rybbit instance in real time, with the visitor's real IP address preserved via X-Forwarded-For.
The randomized prefix breaks ad blocker rules that anchor on the platform-pattern /api/ path used by analytics services. You can regenerate paths anytime, refresh the script cache manually, and verify proxy reachability with the Test Proxy button.
The proxy works on most hosts without webserver-level changes. On WordPress Multisite, each subsite gets its own proxy paths (subdirectory subsites can share the parent domain's Rybbit Site ID; subdomain and mapped-domain subsites have their own).
The tracking script is injected into your page HTML via wp_enqueue_script(), so it becomes part of the cached HTML output. This is normally desirable: once cached, the script tag is served on every page hit without any per-request PHP work.
The trade-off: if you enable, disable, or change tracking settings, your cached HTML still reflects the previous state. You'll need to purge your page cache (FastCGI, Cloudflare, Varnish, etc.) for the change to take effect on the frontend.
The built-in proxy's cached script files (/tsr-{hash}/script.js etc.) are static files at WordPress root, served directly by your webserver. They're independent of WordPress page caching: they refresh on their own daily-cron schedule and aren't affected by page cache purges.
_tinker_stats_views with current-calendar-month-only data on each hourly run, causing values to collapse at month boundaries. The cron now queries lifetime cumulative metrics — start date is auto-detected from your Rybbit instance's site creation date and cached, with sanity bounds and re-detection when connection details change.wp_remote_request(). Same timeout, SSL verification, and request shape as before; this is a coding-standards refactor, not a behavior change.$_SERVER reads in the deployed MU-plugin now properly unslashed and sanitized.Network: false plugin header line — single-site is the implicit default and only Network: true is a valid value per WordPress.org spec.wp-content/mu-plugins/tinker-stats-proxy.php that handles forwarded /track and /site/tracking-config/ requests directly, bypassing the full WordPress bootstrap. Works on single-site and WordPress Multisite (each subsite gets its own per-host config sidecar). Falls back automatically to the existing PHP handler if the mu-plugins directory isn't writable; the proxy works in either mode.define( 'TINKER_STATS_PROXY_DEBUG', true ); to wp-config.php. When enabled, each forwarded tracking request writes one line to the PHP error log capturing the inbound IP-related $_SERVER values, the IP the proxy resolved as the visitor's, and the exact X-Real-IP / X-Forwarded-* headers sent to Rybbit. Off by default; safe to leave in production.home_view event — homepage hits now carry the page title alongside other custom-event metadata.get_queried_object() failed to resolve — most commonly bot or invalid URL hits to /author/{slug}/ for slugs that don't match any user. The tracking script now defensively type-checks the queried object on singular, term, and author archive branches before reading properties. Unresolvable archives no longer fire tracking events with garbage metadata./track events. Rybbit's track endpoint honors this body field directly, bypassing any Cloudflare or nginx layer between the WordPress server and the Rybbit backend that may otherwise overwrite reverse-proxy headers like X-Real-IP. Pageviews, custom events, errors, and outbound clicks now record the real visitor IP regardless of the Rybbit deployment topology. (Note: Rybbit's /identify and session-replay endpoints don't currently support this override pattern; an upstream Rybbit change would close that gap.)X-Forwarded-For, causing Rybbit to record the WordPress server's IP instead of the real visitor IP on setups that use X-Real-IP for client identification. Proxy now sets X-Forwarded-For, X-Real-IP, X-Forwarded-Proto, and X-Forwarded-Host, matching the standard reverse-proxy header pattern.home_view event was sending an empty properties array ([]) instead of an empty object ({}), which Rybbit's analytics database rejects. Some setups dropped only the home_view row; others dropped the homepage pageview alongside it.tsr-{hash}/ directory so nginx serves them from disk as static assets. Non-static endpoints (/track, /site/tracking-config/..., etc.) continue to route through PHP under the same prefix.JSON_FORCE_OBJECT) so any future event with empty metadata can't reproduce the same failure mode./k3p9m2qr/script.js).script.js, replay.js, and metrics.js from your Rybbit instance. Filterable via tinker_stats_proxy_refresh_interval./[hash]/track) preserves real visitor IP via X-Forwarded-For (Cloudflare-aware)./api/* — proxy keeps working without plugin update if Rybbit adds new endpoints./wp-content/uploads/tinker-stats-proxy-cache/ survives plugin updates.parse_request for routing, which works on all single-site and multisite installs. A faster MU-plugin path for single-site installs is planned for a future release.