Overview

Plugin access

use johnhenry\clickyanalytics\ClickyAnalytics;

$plugin = ClickyAnalytics::getInstance();

Service components

ComponentClassPurpose
api services\Api Wraps the Clicky stats API: requests, normalisation, caching, and the typed report methods.

Access it via the plugin instance:

$api = ClickyAnalytics::getInstance()->getApi();

Settings

models\Settings holds the credentials and dashboard defaults. The siteId and siteKey attributes support environment-variable syntax and are resolved lazily through getters.

PropertyDefaultNotes
siteId null Clicky Site ID, or an $ENV_VAR reference. Read resolved via getSiteId()
siteKey null Clicky Sitekey, or an $ENV_VAR reference. Read resolved via getSiteKey().
defaultDateRange last-7-days Date expression used when a widget/field/template doesn't specify one.
cacheDuration 300 Seconds to cache API responses. 0 disables caching entirely (every request hits the Clicky API fresh).
colorScheme clicky One of clicky, ocean, mono, forest, berry.
injectTrackingCode false Automatically injects the Clicky tracking snippet into every front-end page.
trackNoScript true Includes the
compactDensity false Uses tighter spacing across the widgets and page-stats field instead of the comfortable default.
slimBarStyle false Uses a slimmer ranked-list bar style instead of the full-size one.
$settings = ClickyAnalytics::getInstance()->getSettings();
$siteId = $settings->getSiteId();

Any value present in config/clicky-analytics.php overrides the saved setting and renders that field read-only in the control panel.

Field type

fields\PageStats is the Clicky Analytics Page Stats field. It stores no value; on render it asks the Api service for the owning entry's per-page analytics, keyed by the entry's URL. See Page Stats Field.

Widgets

The plugin registers 21 dashboard widget types under widgets\, sharing three base classes:

BaseRole
widgets\BaseWidget Common settings (date range), configuration and rendering.
widgets\BaseStatsWidget Tally/headline widgets (Overview, Current Visitors, …).
widgets\BaseListWidget Ranked list widgets (Top Pages, Countries, …) with a row limit.

Twig variable

variables\ClickyVariable is registered as craft.clickyAnalytics. It is a thin pass-through to the Api service plus a few theming helpers. See Templating for the full method list.

Permissions

PermissionAllows
clicky-analytics:addWidgets Adding Clicky Analytics dashboard widgets.