A Kirby 3 plugin for integrating the privacy focused Fathom Analytics service to your site.
This plugin does two things:
Download and copy this repository to the plugins folder of your Kirby 3 installation. You should end up with a folder structure like this:
/site/plugins/fathom-analytics
If you prefer to use Git submodules, you can install the plugin like this:
git submodule add https://github.com/PaulMorel/kirby3-fathom-analytics.git site/plugins/fathom-analytics
If you are using Composer, you can install the plugin like this:
composer require paulmorel/fathom-analytics
After installing the plugin, there a couple of important steps to do in your Fathom Analytics settings.
Afterwards, in your site config, add your SiteID and the share password (if needed).
Example:
return [
/* ... */
'paulmorel.fathom-analytics' => [
'siteId' => 'ABCDEFGH',
'sharePassword' => 'hunter2'
]
/* ... */
];
The tracking code is provided as a snippet, so it can be simply embedded in the <head>
tag with the snippet()
helper function.
If no siteId
is provided, the snippet does nothing.
<head>
<!-- ... -->
<php snippet('fathom-analytics-embed'); ?>
<!-- ... -->
</head>
The plugin provides a panel view that loads your site's analytics dashboard in an iframe. Simply open the menu in the panel's top bar and click on Analytics.
siteId
(Required)This is the SiteID provided by Fathom Analytics at the top of your site's setting page.
sharePassword
This is the share password for your site's dashboard. This is only required if you set Site Sharing to Private.
customDomain
If you use the custom domain feature with Fathom Analytics, you can set it with this option.
Example:
'customDomain' => 'https://armadillo.example.com'
disableForRole
Allows you to disable the tracking code for logged in users with the specified roles. Expects an Array
. Defaults to ['admin']
.
Examples:
'disableForRole' => [
'admin'
],
'disableForRole' => [
'admin',
'editor',
'translator'
],
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
MIT
This plugin is completely free to use, but if you'd like to support me or this project, consider signing-up to Fathom Analytics with my affiliate link.