Verion 0.2
Google Analytics for Kirby CMS.
- Doesn't run the GA script on localhost.
- Doesn't run the GA script if you are logged in.
Table of contents
- Add the config
plugin.ga.id
toconfig.php
. - Add the code below to your footer snippet.
<?php snippet('ga'); ?>
Only the plugin.ga.id
is required.
c::set('plugin.ga.id', '');
c::set('plugin.ga', true);
c::set('plugin.ga.blacklist', [ '127.0.0.1', '::1' ] );
c::set('plugin.ga.debug', false);
c::set('plugin.ga.snippet', 'ga');
The Google Analytics ID. Set it to something like UA-12345678-12
.
c::set('plugin.ga.id', '');
You can deactivate the script by setting this value to false
.
c::set('plugin.ga', true);
Localhost is in the blacklist as default. You can change it.
c::set('plugin.ga.blacklist', [ '127.0.0.1', '::1' ] );
The script is only active for not logged in users and users not on localhost.
If you want to always run the script, set this option to true
.
c::set('plugin.ga.debug', false);
Change the snippet name with this option. You can override the snippet as well.
c::set('plugin.ga.snippet', 'ga');
- Kirby 2.4.1+
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.
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
- Jens Törnell
- iksi - Inspired by KirbyAnalytics