Skip to main content

SiteStats

Public-facing visitor stats for end users. Unlike the Analytics plugin, which sends operator analytics to providers such as GA4 or Naver Analytics, SiteStats renders activity indicators directly on the site.

Status​

KeyValue
Layercomposite
TierL1
Statuswip
Version0.1.0
PriceFree
CategorySocial

Analytics Boundary​

PluginPurposeData flow
AnalyticsOperator analyticsExport to GA4, Naver Analytics, or custom providers
SiteStatsPublic displaySelf-aggregate in Redis and render on the site

SiteStats is not a conversion analytics or advertising measurement plugin. It is for social proof: current visitors, today's visitors, total visitors, popular pages, and live visitor status.

Feature Toggles​

FeatureDescription
countersCurrent / today / total visitors
popular_pagesTop N popular pages
live_feedLive visitor feed
dwell_timeOptional dwell-time helper metric
content_topFuture top-content adapter

Install / Activation​

The project composer.json must include the SiteStats PSR-4 mappings.

"App\\Plugins\\SiteStats\\": "app/Plugins/SiteStats/src/",
"App\\Plugins\\SiteStats\\Database\\": "app/Plugins/SiteStats/database/",
"App\\Plugins\\SiteStats\\Tests\\": "app/Plugins/SiteStats/tests/"

When the provider is enabled, routes, views, translations, config, and migrations are registered.

App\Plugins\SiteStats\Providers\SiteStatsServiceProvider::class

Blade Usage​

Add the beacon once before </body>.

<x-sitestats::beacon />

Place display widgets wherever the site should show them.

<x-sitestats::current />
<x-sitestats::today />
<x-sitestats::total />
<x-sitestats::popular :limit="10" />
<x-sitestats::live />

Visitor Country / Locale Display​

SiteStats can store the request-scoped visitor.context produced by Core in the live feed payload.

FieldMeaning
country_codeCountry code such as KR or JP
country_sourceDefault source, usually cloudflare
locale_hintLocale inferred from country
resolved_localeLocale actually applied to the request
is_estimatedWhether the value is IP-based estimation

When Cloudflare proxying is enabled, Core reads CF-IPCountry. If the header is missing or unmapped, SiteStats silently falls back to the existing live feed display.

Example:

Guest JP Β· ja /bible

IP country is only an estimate. Do not use it for security, authorization, billing, or tenant decisions.

CORE_VISITOR_COUNTRY_DETECTION=true
CORE_VISITOR_COUNTRY_HEADER=CF-IPCountry
CORE_VISITOR_COUNTRY_SOURCE=cloudflare

The country-based locale hint has lower priority than explicit ?lang, user preference, session, and browser Accept-Language.

Storage​

ItemStore
Current visitorsRedis ZSET
Today / total unique visitorsRedis HyperLogLog
Popular pagesRedis ZSET
Live feedRedis HASH
Accumulated snapshotsDB snapshot table

The Redis live payload does not store raw IP addresses. It stores only the normalized visitor context fields.

Security / Privacy​

  • Beacon POST uses same-origin requests with CSRF.
  • Bots are filtered by JS beacon behavior and server-side UA checks.
  • Raw IP addresses are not stored for public display.
  • Redis keys are isolated with tenant key prefixes.

Demos / Docs​


View on Plugin Store: store.codebase.how/plugins/site-stats