---
title: Overview
date: 2026-07-02T15:08:00+01:00
author: John Henry Donovan
canonical_url: "https://johnhenry.ie/plugins/clicky-analytics/docs/api-reference/overview"
section: Plugins
---
esc

↑↓ to navigate↵ to selectesc to close

Menu On this page 

- [Return to top](#)

Documentation

Documentation

# Overview

## Plugin access

```php
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:

```php
$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 `<noscript></noscript>` tracking pixel fallback alongside the JS snippet.`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.

```php
$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](https://johnhenry.ie/plugins/clicky-analytics/docs/guide/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](https://johnhenry.ie/plugins/clicky-analytics/docs/guide/templating) for the full method list.

## Permissions

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

On this page
