This plugin enables Publii site owners to easily integrate GoatCounter analytics and visitor counters into their websites, providing insights into site traffic and individual page views without compromising user privacy.
- Simple GoatCounter code integration.
- Optional visitor counter display with customization options.
- Support for HTML, SVG, and PNG counter types.
- Customizable counter position using CSS selectors.
- Option to remove GoatCounter branding from the visitor counter.
-
GoatCounter Endpoint: You’ll need to copy this into the Endpoint field on the plugin configuration screen.
-
Plugin Configuration: Navigate to your Publii site settings and find the GoatCounter Integration plugin under the "Plugins" section.
-
Enter GoatCounter Code: Input your GoatCounter code in the provided field to link your Publii site with GoatCounter analytics.
-
Preview Mode: Optionally, enable the output of the analytics code in preview mode for testing purposes. Remember to disable this before going live to avoid skewed analytics data.
To display a visitor counter on your site:
-
Enable Visitor Counter: Check the "Show Visitor Counter" option in the plugin settings on Publii. You will need to enable “Allow adding visitor counts on your website” in your site settings panel on GoatCounter; this defaults to off to prevent unintentional leaking of data.
-
Selector Configuration: Specify the CSS selector for the parent element where the visitor counter will be appended. Default is
footer
. -
Counter Type: Choose the type of visitor counter (HTML, SVG, or PNG) according to your preference. An example of how this looks with the default settings:
-
Remove Branding: Optionally, enable "Remove GoatCounter Branding" to hide the "by GoatCounter" text from the visitor counter.
The visitor counter can be further customized through CSS. Depending on the counter type chosen (HTML or SVG), different elements can be styled:
- HTML Counter: Style the surrounding
div
and internal elements as needed. - SVG Counter: Customize the
#gcvc-border
,#gcvc-for
,#gcvc-views
, and#gcvc-by
elements using CSS.
Refer to the GoatCounter documentation for more detailed information on styling counters.
This plugin does not handle GDPR consent, since GoattCounter (probably) does not require it. More information here: GDPR consent notices.
For more details on GoatCounter and its features, visit the official GoatCounter website.
This plugin is licensed under the MIT License.
Feel free to contribute to the development or suggest improvements by submitting a pull request or opening an issue on GitHub.